-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File based cli tests using trycmd #2205
Conversation
inspired by mthom#2191 but for the `run_top_level_test_with_args`s and `run_top_level_test_no_args instead of the `load_module_test`s
- goals.pl is used by both compound_goal.toml and multiple_goals.toml therefor renamed the later to share a common prefix with goals.pl, to keep them together
- this re-enables line ending and file path normalization - the latter might be unwanted, but there is only a shared flag - this might result in too loose matching of / and \ in stdout and stderr as prolog syntax may be mistaken for a path
Oh, this appears to have some overlap with #2191 as that does not just do |
Nice! I liked that 2191 enumerated the tests within the standard rust test harness, but I like that it actually works even more. 🤷 It would be nice to be able to interact with the machine as a library replacing stdin|out with programmatically managed byte streams, but it seems that this is either not possible or at least it's not known how to do it today. Maybe I'll open a separate issue to discuss the merits of this goal and track progress. Yes I think it would be good to unify the different test suites as far as possible, converting most tests to one format. IMO, ideally all the prolog tests would be moved under the Maybe the test enumerator could use |
Having integration tests in I don't think any of these make particularly sense to convert to unit tests in the library modules in
I tried that but that didn't appear to have the desired effect. Instead of expecting a general test case failure it expected a failing exit code, but still expected the output to match, which is not what we need here. |
@Skgland: |
|
… `<testcase>.in/` follow up to mthom#2205
Inspired by the work in #2191 for
load_module_test
tests.This changes the
run_top_level_test_{with,no}_args
test to use trycmd to enumerate and run tests.Having
.stderr
,.stdin
and.stdout
files improves the readability comparred to multiline strings with escaping.stderr
and.stdout
can be auto-generatedTRYCMD=dump cargo test -- cli_tests
dump/
for checking and will then need to be moved next to.toml
.stderr
and.stdout
can be updated withTRYCMD=overwrite cargo test -- cli_tests
.stderr
and.stdout
will be replacedPreviously stderr was ignored, now it is checked to be empty (.stderr files are empty).
Path normalization might be a problem as it might normalize slashes in prolog syntax should it be mistaken for a path, but disabling normalization makes windows fail due to different line endings. trycmd only has a shared flag for disabling line ending and path normalization 😞
Note: trycmd enumerates the test at runtime, this is different from #2191 where the tests are enumerated at compiletime. As a result they show up as a single
cli_tests
test in cargo.