tree: 7cc380f4e2f80423948fc063c65f80adcda1c761 [path history] [tgz]
  1. basic.txt
  2. basic2.txt
  3. comments.txt
  4. conjunction.txt
  5. disjunction.txt
  6. empty.txt
  7. equality.txt
  8. error.txt
  9. error2.txt
  10. expr.txt
  11. function.txt
  12. function2.txt
  13. member.txt
  14. negation.txt
  15. other.txt
  16. parentheses.txt
  17. phrase.txt
  18. prec.txt
  19. README.md
  20. regexp.txt
  21. unicode.txt
internal/filter/testdata/parse/README.md

Parser tests

This directory contains tests of the AIP 160 parser.

The tests are in txtar.

The txtar files alternate between tests and test results. A test will be named something like “star.test”. It will contain a string, possibly multiple lines, to pass to Parse. A “star.test” entry will be followed by either “star.out” or “star.err”.

A “star.out” entry means that Parse is expected to succeed. Printing the resulting Expr, using the String method, should match the contents of “star.out”.

A “star.err” entry means that Parse is expected to fail. The Error method of the resulting error should match the contents of “star.err”.

In the case of changes to the parser, the txtar files may be easily regenerated to match the current code by running

go test -test.run=TestParse -update

You can update the contents of a single txtar file by naming the file in the -test.run option, as in

go test -test.run=TestParse/regexp -update

Of course, after using -update, carefully check any changes to the .txt files to make sure that the tests are still valid.