mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 09:06:15 +02:00
* Test for `nix-instantiate --eval-only --xml'.
This commit is contained in:
parent
24e234a2fa
commit
4874fd2d9a
4 changed files with 68 additions and 1 deletions
|
@ -44,6 +44,17 @@ for i in lang/eval-okay-*.nix; do
|
||||||
echo "FAIL: evaluation result of $i not as expected"
|
echo "FAIL: evaluation result of $i not as expected"
|
||||||
fail=1
|
fail=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -e lang/$i.exp.xml; then
|
||||||
|
if ! $nixinstantiate --eval-only --xml --strict - < lang/$i.nix > lang/$i.out.xml; then
|
||||||
|
echo "FAIL: $i should evaluate"
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
if ! cmp -s lang/$i.out.xml lang/$i.exp.xml; then
|
||||||
|
echo "FAIL: XML evaluation result of $i not as expected"
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
exit $fail
|
exit $fail
|
1
tests/lang/eval-okay-xml.exp
Normal file
1
tests/lang/eval-okay-xml.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Attrs([Bind("c",OpPlus(Str("foo"),Str("bar")),Pos("(string)",9,4)),Bind("b",Str("bar"),Pos("(string)",7,4)),Bind("x",Int(123),Pos("(string)",3,4)),Bind("f",Function([Formal("z",UnrestrictedValues,NoDefaultValue),Formal("x",ValidValues([Str("a"),Str("b"),OpPlus(Str("c"),Str("d"))]),NoDefaultValue),Formal("y",ValidValues([Var("true"),Var("false")]),NoDefaultValue)],If(Var("y"),Var("x"),Var("z")),Pos("(string)",11,8)),Pos("(string)",11,4)),Bind("a",Str("foo"),Pos("(string)",5,4))])
|
42
tests/lang/eval-okay-xml.exp.xml
Normal file
42
tests/lang/eval-okay-xml.exp.xml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<expr>
|
||||||
|
<attrs>
|
||||||
|
<attr name="a">
|
||||||
|
<string value="foo" />
|
||||||
|
</attr>
|
||||||
|
<attr name="b">
|
||||||
|
<string value="bar" />
|
||||||
|
</attr>
|
||||||
|
<attr name="c">
|
||||||
|
<string value="foobar" />
|
||||||
|
</attr>
|
||||||
|
<attr name="f">
|
||||||
|
<function>
|
||||||
|
<arg name="z">
|
||||||
|
</arg>
|
||||||
|
<arg name="x">
|
||||||
|
<value>
|
||||||
|
<string value="a" />
|
||||||
|
</value>
|
||||||
|
<value>
|
||||||
|
<string value="b" />
|
||||||
|
</value>
|
||||||
|
<value>
|
||||||
|
<string value="cd" />
|
||||||
|
</value>
|
||||||
|
</arg>
|
||||||
|
<arg name="y">
|
||||||
|
<value>
|
||||||
|
<bool value="true" />
|
||||||
|
</value>
|
||||||
|
<value>
|
||||||
|
<bool value="false" />
|
||||||
|
</value>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
|
</attr>
|
||||||
|
<attr name="x">
|
||||||
|
<int value="123" />
|
||||||
|
</attr>
|
||||||
|
</attrs>
|
||||||
|
</expr>
|
13
tests/lang/eval-okay-xml.nix
Normal file
13
tests/lang/eval-okay-xml.nix
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
rec {
|
||||||
|
|
||||||
|
x = 123;
|
||||||
|
|
||||||
|
a = "foo";
|
||||||
|
|
||||||
|
b = "bar";
|
||||||
|
|
||||||
|
c = "foo" + "bar";
|
||||||
|
|
||||||
|
f = {z, x : ["a" "b" ("c" + "d")], y : [true false]}: if y then x else z;
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue