| 1 |
Tests can take two forms. |
| 2 |
|
| 3 |
1. Simple. A simple test just prints "success" (<<< "success" >>>;) if it |
| 4 |
succeeds. Anything else or nothing printed at all means the test fails. |
| 5 |
Most tests in the 01-Basics folder are simple tests. |
| 6 |
|
| 7 |
2. Not simple. If your test prints out more than just "success" (e.g. a |
| 8 |
test that removes shreds will print messages from the ChucK VM), then |
| 9 |
redirect the output of running that test to a text file with the name base |
| 10 |
name as the test, but with the .txt extension (e.g. 147_shred.ck -> |
| 11 |
147_shred.txt). The output of running the ChucK file will be compared to |
| 12 |
the text file. If they match, the test passes. |
| 13 |
|
| 14 |
example: the simplest way to capture an output of a chuck program |
| 15 |
``` |
| 16 |
chuck 9001_sporks.ck 2> 9001_sporks.txt |
| 17 |
``` |
| 18 |
|
| 19 |
Run tests like this: |
| 20 |
``` |
| 21 |
python test.py <chuck_executable> |
| 22 |
``` |
| 23 |
|
| 24 |
i.e. your globally installed chuck would be `chuck`, but your built chuck |
| 25 |
would be `../chuck` |