mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 22:43:01 +00:00
formats.keyValue: add tests
This commit is contained in:
parent
3ff9245301
commit
0d2842a435
@ -147,6 +147,51 @@ in runBuildTests {
|
||||
'';
|
||||
};
|
||||
|
||||
testKeyValueAtoms = {
|
||||
drv = evalFormat formats.keyValue {} {
|
||||
bool = true;
|
||||
int = 10;
|
||||
float = 3.141;
|
||||
str = "string";
|
||||
};
|
||||
expected = ''
|
||||
bool=true
|
||||
float=3.141000
|
||||
int=10
|
||||
str=string
|
||||
'';
|
||||
};
|
||||
|
||||
testKeyValueDuplicateKeys = {
|
||||
drv = evalFormat formats.keyValue { listsAsDuplicateKeys = true; } {
|
||||
bar = [ null true "test" 1.2 10 ];
|
||||
baz = false;
|
||||
qux = "qux";
|
||||
};
|
||||
expected = ''
|
||||
bar=null
|
||||
bar=true
|
||||
bar=test
|
||||
bar=1.200000
|
||||
bar=10
|
||||
baz=false
|
||||
qux=qux
|
||||
'';
|
||||
};
|
||||
|
||||
testKeyValueListToValue = {
|
||||
drv = evalFormat formats.keyValue { listToValue = concatMapStringsSep ", " (generators.mkValueStringDefault {}); } {
|
||||
bar = [ null true "test" 1.2 10 ];
|
||||
baz = false;
|
||||
qux = "qux";
|
||||
};
|
||||
expected = ''
|
||||
bar=null, true, test, 1.200000, 10
|
||||
baz=false
|
||||
qux=qux
|
||||
'';
|
||||
};
|
||||
|
||||
testTomlAtoms = {
|
||||
drv = evalFormat formats.toml {} {
|
||||
false = false;
|
||||
|
Loading…
Reference in New Issue
Block a user