1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 01:51:47 +02:00

Make source location info in the XML output optional.

* src/libexpr/expr-to-xml.cc (nix::showAttrs): Add `location'
  parameter.  Provide location XML attributes when it's true.  Update
  callers.
  (nix::printTermAsXML): Likewise.

* src/libexpr/expr-to-xml.hh (nix::printTermAsXML): Update prototype;
  have `location' default to `false'.

* src/nix-instantiate/nix-instantiate.cc (printResult, processExpr): Add
  `location' parameter; update callers.
  (run): Add support for `--no-location'.

* src/nix-instantiate/help.txt: Update accordingly.

* tests/lang.sh: Invoke `nix-instantiate' with `--no-location' for the
  XML tests.

* tests/lang/eval-okay-toxml.exp, tests/lang/eval-okay-to-xml.nix: New
  files.
This commit is contained in:
Ludovic Courtès 2010-03-31 12:38:31 +00:00
parent 471419d1fa
commit 09381cccff
7 changed files with 29 additions and 19 deletions

View file

@ -54,7 +54,8 @@ for i in lang/eval-okay-*.nix; do
fi
if test -e lang/$i.exp.xml; then
if ! $nixinstantiate --eval-only --xml --strict lang/$i.nix > lang/$i.out.xml; then
if ! $nixinstantiate --eval-only --xml --no-location --strict \
lang/$i.nix > lang/$i.out.xml; then
echo "FAIL: $i should evaluate"
fail=1
elif ! cmp -s lang/$i.out.xml lang/$i.exp.xml; then

View file

@ -0,0 +1 @@
Str("<?xml version='1.0' encoding='utf-8'?>\n<expr>\n <attrs>\n <attr name=\"a\">\n <string value=\"s\" />\n </attr>\n </attrs>\n</expr>\n",[])

View file

@ -0,0 +1,3 @@
# Make sure the expected XML output is produced; in particular, make sure it
# doesn't contain source location information.
builtins.toXML { a = "s"; }