Lines Matching +full:eq +full:- +full:level

16 # ----- @module teaish/tester.tcl -----
18 # @section TEA-ish Testing APIs.
26 # @test-current-scope ?lvl?
29 # call stack (where the caller's level will be 1 up from _this_
34 proc test-current-scope {{lvl 0}} {
35 #uplevel [expr {$lvl + 1}] {lindex [info level 0] 0}
36 set ilvl [info level]
37 set offset [expr {$ilvl - $lvl - 1}]
43 return [lindex [info level $offset] 0]
47 # @test-msg
51 proc test-msg {args} {
55 # @test-warn
59 proc test-warn {args} {
64 # @test-error msg
66 # Triggers a test-failed error with a string describing the calling
69 proc test-fail {args} {
70 #puts stderr "ERROR: \[[test-current-scope 1]]: $msg"
72 error "FAIL: \[[test-current-scope 1]]: $args"
77 verbose-assert 0 verbose-affirm 0
82 # $args = ?-v? script {msg-on-fail ""}
89 set verbose $::test__Config(verbose-$what)
90 if {"-v" eq [lindex $args 0]} {
91 lassign $args - script msg
93 # If -v is the only arg, toggle default verbose mode
94 set ::test__Config(verbose-$what) [expr {!$::test__Config(verbose-$what)}]
103 if {"" eq $msg} {
119 # @affirm ?-v? script ?msg?
122 # using [error] instead of [exit]. If -v is used, it reports passing
131 # @assert ?-v? script ?msg?
140 # @test-assert testId script ?msg?
144 proc test-assert {testId script {msg ""}} {
150 # @test-expect testId script result
156 proc test-expect {testId script result} {
160 tailcall test__affert 0 [list $x eq $result] \
165 # @test-catch cmd ?...args?
170 proc test-catch {cmd args} {
174 puts "[test-current-scope] ignoring failure of: $cmd [lindex $args 0]: $rc"
185 # @teaish-build-flag3 flag tgtVar ?dflt?
187 # If the current build has the configure-time flag named $flag set
194 # doesn't fully exist at that point and (B) that level of the API has
200 # 0 are, by long-standing configure script conventions, treated as
203 proc teaish-build-flag3 {flag tgtVar {dflt ""}} {
209 test-warn \
210 "\[[test-current-scope]] was called from " \
211 "[test-current-scope 1] without the build flags imported."
218 # @teaish-build-flag flag ?dflt?
220 # Convenience form of teaish-build-flag3 which returns the
221 # configure-time-defined value of $flag or "" if it's not defined (or
224 proc teaish-build-flag {flag {dflt ""}} {
226 teaish-build-flag3 $flag tgt $dflt