Skip to content

Commit

Permalink
Add tests for --warning
Browse files Browse the repository at this point in the history
Added quotes to the test since those seem the most likely to stop
working upon future code changes.
  • Loading branch information
victorlin committed Jan 17, 2025
1 parent 8fb9b35 commit 1bc221c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/functional/export_v2/cram/warning.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Setup

$ source "$TESTDIR"/_setup.sh

Specify a warning as text.

$ ${AUGUR} export v2 \
> --tree "$TESTDIR/../data/tree.nwk" \
> --warning 'A warning with "quotes"' \
> --skip-validation \
> --output dataset.json &>/dev/null

TODO: Switch to use jq once it's available in a well-defined test environment.
<https://github.com/nextstrain/augur/issues/1557>

$ python3 -c 'import json, sys; print(json.load(sys.stdin)["meta"]["warning"])' < dataset.json
A warning with "quotes"

Add a warning from a markdown file.

$ cat >warning.md <<~~
> A warning with "quotes".
> ~~

$ ${AUGUR} export v2 \
> --tree "$TESTDIR/../data/tree.nwk" \
> --warning warning.md \
> --skip-validation \
> --output dataset.json &>/dev/null

$ python3 -c 'import json, sys; print(json.load(sys.stdin)["meta"]["warning"])' < dataset.json
A warning with "quotes".


Note: there is an extra newline compared to the original contents. This extra
newline is harmless and can be explained by `augur export` embedding the
original trailing newline explicitly, followed by an additional trailing newline
when writing to extracted-warning.md.

0 comments on commit 1bc221c

Please sign in to comment.