Convert tests to tcltest and integrate into Travis (#5)
* convert some tests to tcltest * exit with non-zero value if any test fails
This commit is contained in:
38
tests/all.tcl
Executable file
38
tests/all.tcl
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env tclsh
|
||||
|
||||
package require tcltest
|
||||
|
||||
::tcltest::configure -testdir [file dirname [file normalize [info script]]]
|
||||
|
||||
# The following will be upleveled and run whenever a test calls
|
||||
# ::tcltest::loadTestedCommands
|
||||
::tcltest::configure -load {
|
||||
|
||||
namespace import ::tcltest::*
|
||||
}
|
||||
|
||||
::tcltest::skipFiles [list]
|
||||
|
||||
|
||||
# Hook to determine if any of the tests failed. Then we can exit with
|
||||
# proper exit code: 0=all passed, 1=one or more failed
|
||||
proc tcltest::cleanupTestsHook {} {
|
||||
variable numTests
|
||||
set ::exitCode [expr {$numTests(Failed) > 0}]
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Allow command line arguments to be passed to the configure command
|
||||
# This supports only running a single test or a single test file
|
||||
::tcltest::configure {*}$argv
|
||||
|
||||
::tcltest::runAllTests
|
||||
|
||||
if {$exitCode == 1} {
|
||||
puts "====== FAIL ====="
|
||||
exit $exitCode
|
||||
} else {
|
||||
puts "====== SUCCESS ====="
|
||||
}
|
||||
|
Reference in New Issue
Block a user