On tcl tests - how to interpret tcltest::test -


i looking @ tests in tcl source tree , see 1 in compexpr-old.test:

test compexpr-old-14.17 {compileprimaryexpr: string primary looks var ref} {     expr $ } $ 

it looks wrong me: test runs script expr $ , expects return value "$". interpretation right?

it cannot right because expr $ wrong syntactically.

i checked out tcltest.tcl, definition of tcltest::test long, wish can me on here.

i don't know version of test suite looking @ (probably 8.4 variant?), when @ whole of test in tcl trunk, see this:

test compexpr-old-14.17 {compileprimaryexpr: string primary looks var ref} -body {     expr $ } -returncodes error -match glob -result * 

in case, checking result error , value of result (i.e., content of error message) glob matches *, i.e., (effectively ignoring it). is, test checks error obtained expr $ , otherwise doesn't care.

the test posted (which uses older syntax tcltest) won't pass on modern versions of tcl. in 8.4, did pass; area tcl's semantics changed between 8.4 , 8.5:

dkf$ tclsh8.4 % expr $ $ % exit 
dkf$ tclsh8.5 % expr $ invalid character "$" in expression "$" % exit 

quick guide tcltest test cases: -body describes scrip run, -returncode can used select whether normal results or errors expected, -result can used string expect result of body script, , -match can used pick alternate matching scheme default (exact string equality). there's -constraints specifying preconditions on test, -setup doing setup code, , -cleanup cleanup code. 2 leading mandatory arguments name of test (which must unique within test suite own sanity) , short description of test, used in reporting of failures.

in old syntax (used in of tcl's test suite because updating ton of boring work), instead had same 2 mandatory arguments, optional list of constraints (as -constraints), mandatory body (as -body), mandatory string match equality (as -result). less flexible, not hard understand.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -