Skip to content

Commit

Permalink
tests: Add function calls with list-heavy arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
piegamesde committed Oct 2, 2024
1 parent d0c0cda commit 7c0a82c
Show file tree
Hide file tree
Showing 3 changed files with 308 additions and 0 deletions.
64 changes: 64 additions & 0 deletions test/diff/apply_with_lists/in.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# This file contains an assortment of test cases involving list-heavy function calls

[
(f [ ] [ rhs lhs ])
(lib.mkMerge [ false false ])
(replaceStrings
[ "\${" "''" ]
#force multiline
[ "''\${" "'''" ])
(replaceStrings [ ''"'' "\\" ] [ ''\"'' "\\\\" ] name)
(replaceStrings
[ ''"'' "\\" ]
# force multiline
[ ''\"'' "\\\\" ]
name)
(replaceStrings
[ "@" ":" "\\" "[" "]" ]
[ "-" "-" "-" "" "" ])
(lists.removePrefix [ 1 2 ] [ ])
(lists.removePrefix aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [ 1 2 ] [ ])
(builtins.replaceStrings
[ "@NIX_STORE_VERITY@" ]
[partitionTypes.usr-verity]
(builtins.readFile ./assert_uki_repart_match.py))
(replaceStrings [ "-" ] [ "_" ] (toUpper final.rust.cargoShortTarget))
(lib.mkChangedOptionModule
[ "security" "acme" "validMin" ]
[ "security" "acme" "defaults" "validMinDays" ]
(config: config.security.acme.validMin / (24 * 3600)))
(lib.replaceStrings
[ "https://registry" ".io/providers" ]
[ "registry" ".io" ]
homepage)
(lib.mkRenamedOptionModule [ "boot" "extraTTYs" ] [ "console" "extraTTYs" ])
(mkRenamedOptionModule [
"services"
"xserver"
"displayManager"
"sddm"
"enable"
] [ "services" "displayManager" "sddm" "enable" ])
(map (buildAllowCommand "allow" [ "snapshot" "mount" "destroy" ]))
(map (x: "${x} ${escapeShellArgs [ stateDir workDir logsDir ]}") [
"+${unconfigureRunner}" # runs as root
configureRunner
setupWorkDir
])
(lib.switch [ coq.coq-version ssreflect.version ] [
{
cases = [
(lib.versions.range "8.15" "8.20")
lib.pred.true
];
out = "2.0.4";
}
{
cases = [
"8.5"
lib.pred.true
];
out = "20170512";
}
] null)
]
122 changes: 122 additions & 0 deletions test/diff/apply_with_lists/out-pure.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# This file contains an assortment of test cases involving list-heavy function calls

[
(f [ ] [
rhs
lhs
])
(lib.mkMerge [
false
false
])
(replaceStrings [ "\${" "''" ]
#force multiline
[
"''\${"
"'''"
]
)
(replaceStrings [ ''"'' "\\" ] [ ''\"'' "\\\\" ] name)
(replaceStrings [ ''"'' "\\" ]
# force multiline
[ ''\"'' "\\\\" ]
name
)
(replaceStrings
[
"@"
":"
"\\"
"["
"]"
]
[
"-"
"-"
"-"
""
""
]
)
(lists.removePrefix [
1
2
] [ ])
(lists.removePrefix aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [
1
2
] [ ])
(builtins.replaceStrings [ "@NIX_STORE_VERITY@" ] [
partitionTypes.usr-verity
] (builtins.readFile ./assert_uki_repart_match.py))
(replaceStrings [ "-" ] [ "_" ] (toUpper final.rust.cargoShortTarget))
(lib.mkChangedOptionModule [ "security" "acme" "validMin" ] [
"security"
"acme"
"defaults"
"validMinDays"
] (config: config.security.acme.validMin / (24 * 3600)))
(lib.replaceStrings [ "https://registry" ".io/providers" ] [
"registry"
".io"
] homepage)
(lib.mkRenamedOptionModule [ "boot" "extraTTYs" ] [
"console"
"extraTTYs"
])
(mkRenamedOptionModule
[
"services"
"xserver"
"displayManager"
"sddm"
"enable"
]
[
"services"
"displayManager"
"sddm"
"enable"
]
)
(map (
buildAllowCommand "allow" [
"snapshot"
"mount"
"destroy"
]
))
(map
(
x:
"${x} ${
escapeShellArgs [
stateDir
workDir
logsDir
]
}"
)
[
"+${unconfigureRunner}" # runs as root
configureRunner
setupWorkDir
]
)
(lib.switch [ coq.coq-version ssreflect.version ] [
{
cases = [
(lib.versions.range "8.15" "8.20")
lib.pred.true
];
out = "2.0.4";
}
{
cases = [
"8.5"
lib.pred.true
];
out = "20170512";
}
] null)
]
122 changes: 122 additions & 0 deletions test/diff/apply_with_lists/out.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# This file contains an assortment of test cases involving list-heavy function calls

[
(f [ ] [
rhs
lhs
])
(lib.mkMerge [
false
false
])
(replaceStrings [ "\${" "''" ]
#force multiline
[
"''\${"
"'''"
]
)
(replaceStrings [ ''"'' "\\" ] [ ''\"'' "\\\\" ] name)
(replaceStrings [ ''"'' "\\" ]
# force multiline
[ ''\"'' "\\\\" ]
name
)
(replaceStrings
[
"@"
":"
"\\"
"["
"]"
]
[
"-"
"-"
"-"
""
""
]
)
(lists.removePrefix [
1
2
] [ ])
(lists.removePrefix aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [
1
2
] [ ])
(builtins.replaceStrings [ "@NIX_STORE_VERITY@" ] [
partitionTypes.usr-verity
] (builtins.readFile ./assert_uki_repart_match.py))
(replaceStrings [ "-" ] [ "_" ] (toUpper final.rust.cargoShortTarget))
(lib.mkChangedOptionModule [ "security" "acme" "validMin" ] [
"security"
"acme"
"defaults"
"validMinDays"
] (config: config.security.acme.validMin / (24 * 3600)))
(lib.replaceStrings [ "https://registry" ".io/providers" ] [
"registry"
".io"
] homepage)
(lib.mkRenamedOptionModule [ "boot" "extraTTYs" ] [
"console"
"extraTTYs"
])
(mkRenamedOptionModule
[
"services"
"xserver"
"displayManager"
"sddm"
"enable"
]
[
"services"
"displayManager"
"sddm"
"enable"
]
)
(map (
buildAllowCommand "allow" [
"snapshot"
"mount"
"destroy"
]
))
(map
(
x:
"${x} ${
escapeShellArgs [
stateDir
workDir
logsDir
]
}"
)
[
"+${unconfigureRunner}" # runs as root
configureRunner
setupWorkDir
]
)
(lib.switch [ coq.coq-version ssreflect.version ] [
{
cases = [
(lib.versions.range "8.15" "8.20")
lib.pred.true
];
out = "2.0.4";
}
{
cases = [
"8.5"
lib.pred.true
];
out = "20170512";
}
] null)
]

0 comments on commit 7c0a82c

Please sign in to comment.