Skip to content

run the unit tests in travis #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ script:
- if [ -f /usr/local/opt/tcl-tk/lib/tclConfig.sh ]; then ./configure --with-tcl=/usr/local/opt/tcl-tk/lib --prefix=/usr/local; else ./configure; fi
- make
- sudo make install
- make test
39 changes: 22 additions & 17 deletions tests/all.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ set ::tcltest::testsDirectory [file dir [info script]]

# We need to ensure that the testsDirectory is absolute
::tcltest::normalizePath ::tcltest::testsDirectory
::tcltest::configure -testdir [file dirname [file normalize [info script]]]
::tcltest::configure {*}$argv

puts stdout "Tests running in interp: [info nameofexecutable]"
puts stdout "Tests running with pwd: [pwd]"
Expand All @@ -39,29 +41,32 @@ puts stdout "Tests began at [eval $timeCmd]"

package require Tclx 8.4


# 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}]
}


# source each of the specified tests
foreach file [lsort [::tcltest::getMatchingFiles]] {
set tail [file tail $file]
puts stdout $tail
if {[catch {source $file} msg]} {
puts stdout $msg
}
set tail [file tail $file]
puts stdout $tail
if {[catch {source $file} msg]} {
puts stdout $msg
}
}
# TODO: convert above to use ::tcltest::runAllTests?s

# cleanup
puts stdout "\nTests ended at [eval $timeCmd]"
::tcltest::cleanupTests 1
return

if 0 {
proc eq {a b} { cequal $a $b }
proc eq1 {a b} { string equal $a $b }
proc eq2 {a b} { foo $a $b}
interp alias {} foo {} string equal
set a [string repeat a 50]b
set b [string repeat a 50]b
set c [string repeat a 50]c
eq $a $b
eq1 $a $b
eq2 $a $b
if {$exitCode == 1} {
puts "====== FAIL ====="
exit $exitCode
} else {
puts "====== SUCCESS ====="
}