Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions lib/path/tests/generate.awk

This file was deleted.

60 changes: 0 additions & 60 deletions lib/path/tests/prop.nix

This file was deleted.

179 changes: 0 additions & 179 deletions lib/path/tests/prop.sh

This file was deleted.

5 changes: 5 additions & 0 deletions lib/path/tests/props/normalise-append.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
stage_setup 1000
stage_awk_expr subpath 'gen_valid_subpath()'
stage_nix_expr appended '/. + ("/" + subpath)'
stage_nix_expr normalised_appended '/. + ("/" + lib.path.subpath.normalise subpath)'
stage_check appended == normalised_appended
9 changes: 9 additions & 0 deletions lib/path/tests/props/normalise-error.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
stage_setup 1000
stage_awk_expr \
subpath 'gen_subpath()' \
valid 'subpath_is_valid(subpath) ? "true" : "false"'

stage_nix_expr normalise_success 'lib.boolToString (builtins.tryEval (lib.path.subpath.normalise subpath)).success'

stage_check valid == normalise_success

9 changes: 9 additions & 0 deletions lib/path/tests/props/normalise-idempotent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
stage_setup 1000
stage_awk_expr subpath 'gen_valid_subpath()'
stage_nix_expr normalised 'lib.path.subpath.normalise subpath'
stage_nix_expr normalised_valid 'lib.boolToString (lib.path.subpath.isValid normalised)'
stage_constant normalised_valid_expected true
stage_check normalised_valid == normalised_valid_expected

stage_nix_expr normalised_twice 'lib.path.subpath.normalise normalised'
stage_check normalised == normalised_twice
7 changes: 7 additions & 0 deletions lib/path/tests/props/normalise-realpath.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
stage_setup 300
stage_awk_expr subpath 'gen_valid_subpath()'
stage_nix_expr subpath_normalised 'lib.path.subpath.normalise subpath'
stage_bash_expr subpath_realpath 'realpath -m --relative-to=$PWD -- "$subpath"'
stage_bash_expr subpath_normalised_realpath 'realpath -m --relative-to=$PWD -- "${subpath_normalised}"'

stage_check subpath_realpath == subpath_normalised_realpath
13 changes: 13 additions & 0 deletions lib/path/tests/props/normalise-unique.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
stage_setup 1000
stage_awk_expr \
a 'gen_subpath_with("valid", 5)' \
b 'gen_subpath_with("valid", 5)'

stage_nix_expr a_normalised 'lib.path.subpath.normalise a'
stage_nix_expr b_normalised 'lib.path.subpath.normalise b'
stage_condition a_normalised != b_normalised

stage_bash_expr a_realpath 'realpath -m --relative-to=$PWD -- "$a"'
stage_bash_expr b_realpath 'realpath -m --relative-to=$PWD -- "$b"'

stage_check a_realpath != b_realpath
9 changes: 9 additions & 0 deletions lib/path/tests/props/valid.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
stage_setup 1000

stage_awk_expr \
input 'gen_subpath()' \
expected_valid 'subpath_is_valid(input) ? "true" : "false"'

stage_nix_expr valid 'lib.boolToString (lib.path.subpath.isValid input)'

stage_check valid == expected_valid
Loading