Skip to end of metadata
Go to start of metadata

If you would like to make an extensive test suite more structured, rather than having all the checks in one flat expected file, i.e. you want to run test once, but check many well-structured suites of test cases.

Now, instead of file, you can have a directory called expected.

For example, suppose, you have a test called big-test:

> tree big-test/
big-test/
├── expected
│   ├── address
│   │   └── check_city
│   └── check_temperature
└── test

with the files looking like this:

> cat big-test/test
echo city=sydney
echo temperature=25
 
> cat big-test/expected/address/check_city 
city="melbourne"
 
> cat big-test/expected/check_temperature 
temperature=22

When you run the test, the conditions in check_city and check_temperature will be checked:

> cd big-test
> comma-test-run
comma-test-run: 1 test[s] in subdirectories of /home/seva/src/comma/big-test: running...
comma-test-run: test 1 of 1: .: started...
comma-test-run: test 1 of 1: .: running...
Test output does not match expected:
expected output:
./expected/address/check_city:city/expected="melbourne"
./expected/address/check_city:city/actual="sydney"
./expected/check_temperature:temperature/expected="22"
./expected/check_temperature:temperature/actual="25"
comma-test-run: .: failed
comma-test-run: 1 test[s] in subdirectories of /home/seva/src/comma/big-test: 1 test[s] out of 1 failed
  • No labels