fbf5621eaed2528b17934f869875596fe0b7111e
The project was Makefile-only and non-portable. Adds a top-level CMakeLists.txt so the framework builds with a standard build system: * add_library(JTest STATIC ...) over the 13 src/JTest/*.cpp translation units. No find_package/FetchContent is needed: a full #include scan of include/, src/, examples/ shows the framework depends only on the C++ standard library plus its own <JTest/...> headers. * target_include_directories(JTest PUBLIC include) so consumers that link JTest (the example, tests) inherit the include path transitively. * target_compile_features(JTest PUBLIC cxx_std_17) propagates the C++17 requirement (sources use std::optional). * Portable (no -arch) build: the Makefile's non-portable -arch flag is not carried over (that is T-20's scope). * enable_testing() + add_test() running tests/smoke.cpp, a genuine self-check that exercises the public API and exits non-zero on any failed assertion, so ctest is a real pass/fail gate. The demo example remains a build/run target but is intentionally excluded from the CTest gate (it contains deliberate failing/skipping cases to showcase reporting and always exits 0). Verified end-to-end (CMake 4.4.3, AppleClang 21, out-of-source build): configure OK, builds libJTest.a + example + test_smoke, ctest passes (smoke: Passed, 100%), example demo runs.
TODO:
- Make Expectable toThrow methods work with arguments, class methods, static class methods, and possibly constructors/destructors.
- Report all errors at the end instead of printing them inline. This is needed for parallel support.
- Figure out how to make JTest self testing. Maybe use some namespace magic to run a special instance in another namespace.
- Mocks
- Design them.
- Add them.
- Spies
- Design them.
- Add them.
- Expectable
- Clean up failure messages in Expectable.
- Make failure messages in Expectable only use ostreams if operator<< is defined for T.
- Pick a name for Expectable::not()
- DescribeOptions
- Add operator<< and print for DescribeOptions
- JTest
- Make it and xit return a Test instead of a TestBundle
- Make describe and xdescribe take a variant of Test or TestBundle instead of just TestBundle
- Make TestOptions useful
- Find a way to set label/path from it/xit/describe/xdescribe instead of when we execute them.
- If executing a disabled bundle report all of it's child tests as skipped/disabled.
- Execute tests in parallel.
- Recheck that bundles/tests inherit before/after methods from their parents.
- Before* of parents should be called before that of children.
- After* of parents should be called after that of children.
- When reporting Unhandled exceptions in tests, report the fully qualified test name and label.
- TestResults
- Add commented out vectors to hold skipped, failed, errored test info.
- FailedExpectation
- Figure out a way to get label and path when creating the expectation from an Expect method.
- We need to get the label and path from the parent method (execute) that is calling expect(T) to create the Expectable.
- We will likely be creating the FailedExpectation exception where the test fails and adding the label and path when we catch it before reporting the failure.
- Figure out a way to get label and path when creating the expectation from an Expect method.
Languages
C++
90.8%
CMake
6.2%
Makefile
3%