-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add tests leveraging the existing documentation #26
base: master
Are you sure you want to change the base?
Conversation
Hi D4N,
|
|
fe63ea7
to
921e53c
Compare
I understand that. But let me just say that I'd rather see a project with a sloppy test suite than with none at all. Also, if you make the tests public, they could be added to the CI and run on all pull requests and commits.
I am using the latest commit to run the tests and not a specific tag. There are actually a few other examples that are failing, I have opened issues for some of them (#27 and #28) and will create issues for all remaining failures.
I have added a test run with ASAN+UBSAN, one without and one with valgrind to the CI.
Oh, I did not know that. I will remove it from the test run in the meantime (although all except 3 examples from that file passed).
No problem at all, please take the time you need to review this. |
Using a single bash block makes testing the output from jtc easier.
clang puts a ./ in front of __FILE__, which gcc does not. To remove this difference, we add the constexpr drop_leading_dot_slash() which removes this difference between both compilers.
This is a pretty huge PR consisting of a lot of individual changes, so please review them commit by commit, as otherwise the diff will be too much.
tl;dr; I have noticed that jtc has a pretty impressive documentation, but no tests. So I have written a simple python script that will run all code samples from the documentation and check if the outputs match.
The tests can be now run via
python3 run_tests.py -v User\ Guide.md Walk-path\ tutorial.md README.md
assuming that jtc is inPATH
or in the current working directory. The test runner also supports running all commands throughvalgrind
, simply by adding the--valgrind
flag.This has required some changes to the documentation: I had to adjust a few code samples to be a little less readable (but imho that is bearable) to keep the python script simple as it does not emulate a full shell session. Also, a bunch of outputs were no longer correct and had to be adjusted and quite a few tests failed when run with address sanitizer (these are skipped by changing the code block start from
bash
tobash SKIP
, failures are marked withFIXME
to distinguish them from tests that should never be run).What do you think about this? Worthwhile to pursue further? If yes, then I'd like to address the following points before merging this:
TODO: