Posted to tcl by mjanssen at Fri Sep 21 22:38:32 GMT 2007view pretty

# run as tclsh filename.tcl to run tests
# source in other file to use totest proc

proc totest {a b} {
   return $a$b
}

if {[info script] eq $argv0} {
  # called file so run tests

  package require tcltest

  tcltest::verbose pfs

  tcltest::test TestCase1 {Simple case} -body {
     totest de fg
  } -result {defg}
  

  tcltest::test TestCase2 {Test correct error message} -body {
     totest 12
  } -returnCodes 1 -result {wrong # args: should be "totest a b"}
  
  tcltest::cleanupTests
}