Test framework for TCL - Tcltest - some examples
Archive - Originally posted on "The Horse's Mouth" - 2015-03-11 16:57:03 - Graham EllisTcl ships with the tcltest test suite / harness - and standard advice for coding is to write lots of tests and check with them every time you run your code.
There's a (new) first example [here] - loading in Tcltest and defining 3 tests:
package require tcltest
tcltest::test 001 {Hello test world} {
expr 7 * 9
} 63
tcltest::test 002 {A test that will fail} {
expr 7 * 10
} 64
tcltest::test 003 {Alternative formatting} \
-body { expr 7 * 10 } \
-result {70}
Other examples ...
Using setup and cleanup blocks - [here]
Running all the tests in a dirctory [here]
Running only if certain constraints are met [here]