diff --git a/tests/lang.sh b/tests/lang.sh index f743a18305..bbc97861a4 100644 --- a/tests/lang.sh +++ b/tests/lang.sh @@ -44,6 +44,17 @@ for i in lang/eval-okay-*.nix; do echo "FAIL: evaluation result of $i not as expected" fail=1 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 -exit $fail \ No newline at end of file +exit $fail diff --git a/tests/lang/eval-okay-xml.exp b/tests/lang/eval-okay-xml.exp new file mode 100644 index 0000000000..690599e6ee --- /dev/null +++ b/tests/lang/eval-okay-xml.exp @@ -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))]) diff --git a/tests/lang/eval-okay-xml.exp.xml b/tests/lang/eval-okay-xml.exp.xml new file mode 100644 index 0000000000..bfb34f81d0 --- /dev/null +++ b/tests/lang/eval-okay-xml.exp.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/lang/eval-okay-xml.nix b/tests/lang/eval-okay-xml.nix new file mode 100644 index 0000000000..244b2c0fb4 --- /dev/null +++ b/tests/lang/eval-okay-xml.nix @@ -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; + +} \ No newline at end of file