annotate third_party/sqlite3/autosetup/teaish/tester.tcl @ 167:589bab390fb4

[ThirdParty] Added sqlite3 to the third_party.
author MrJuneJune <me@mrjunejune.com>
date Mon, 19 Jan 2026 16:28:45 -0800
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
167
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
1 ########################################################################
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
2 # 2025 April 5
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
3 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
4 # The author disclaims copyright to this source code. In place of
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
5 # a legal notice, here is a blessing:
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
6 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
7 # * May you do good and not evil.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
8 # * May you find forgiveness for yourself and forgive others.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
9 # * May you share freely, never taking more than you give.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
10 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
11 ########################################################################
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
12 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
13 # Helper routines for running tests on teaish extensions
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
14 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
15 ########################################################################
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
16 # ----- @module teaish/tester.tcl -----
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
17 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
18 # @section TEA-ish Testing APIs.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
19 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
20 # Though these are part of the autosup dir hierarchy, they are not
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
21 # intended to be run from autosetup code. Rather, they're for use
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
22 # with/via teaish.tester.tcl and target canonical Tcl only, not JimTcl
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
23 # (which the autosetup pieces do target).
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
24
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
25 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
26 # @test-current-scope ?lvl?
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
27 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
28 # Returns the name of the _calling_ proc from ($lvl + 1) levels up the
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
29 # call stack (where the caller's level will be 1 up from _this_
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
30 # call). If $lvl would resolve to global scope "global scope" is
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
31 # returned and if it would be negative then a string indicating such
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
32 # is returned (as opposed to throwing an error).
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
33 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
34 proc test-current-scope {{lvl 0}} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
35 #uplevel [expr {$lvl + 1}] {lindex [info level 0] 0}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
36 set ilvl [info level]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
37 set offset [expr {$ilvl - $lvl - 1}]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
38 if { $offset < 0} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
39 return "invalid scope ($offset)"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
40 } elseif { $offset == 0} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
41 return "global scope"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
42 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
43 return [lindex [info level $offset] 0]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
44 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
45 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
46
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
47 # @test-msg
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
48 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
49 # Emits all arugments to stdout.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
50 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
51 proc test-msg {args} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
52 puts "$args"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
53 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
54
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
55 # @test-warn
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
56 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
57 # Emits all arugments to stderr.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
58 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
59 proc test-warn {args} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
60 puts stderr "WARNING: $args"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
61 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
62
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
63 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
64 # @test-error msg
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
65 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
66 # Triggers a test-failed error with a string describing the calling
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
67 # scope and the provided message.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
68 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
69 proc test-fail {args} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
70 #puts stderr "ERROR: \[[test-current-scope 1]]: $msg"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
71 #exit 1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
72 error "FAIL: \[[test-current-scope 1]]: $args"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
73 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
74
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
75 array set ::test__Counters {}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
76 array set ::test__Config {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
77 verbose-assert 0 verbose-affirm 0
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
78 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
79
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
80 # Internal impl for affirm and assert.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
81 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
82 # $args = ?-v? script {msg-on-fail ""}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
83 proc test__affert {failMode args} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
84 if {$failMode} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
85 set what assert
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
86 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
87 set what affirm
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
88 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
89 set verbose $::test__Config(verbose-$what)
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
90 if {"-v" eq [lindex $args 0]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
91 lassign $args - script msg
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
92 if {1 == [llength $args]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
93 # If -v is the only arg, toggle default verbose mode
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
94 set ::test__Config(verbose-$what) [expr {!$::test__Config(verbose-$what)}]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
95 return
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
96 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
97 incr verbose
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
98 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
99 lassign $args script msg
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
100 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
101 incr ::test__Counters($what)
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
102 if {![uplevel 1 expr [list $script]]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
103 if {"" eq $msg} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
104 set msg $script
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
105 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
106 set txt [join [list $what # $::test__Counters($what) "failed:" $msg]]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
107 if {$failMode} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
108 puts stderr $txt
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
109 exit 1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
110 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
111 error $txt
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
112 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
113 } elseif {$verbose} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
114 puts stderr [join [list $what # $::test__Counters($what) "passed:" $script]]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
115 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
116 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
117
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
118 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
119 # @affirm ?-v? script ?msg?
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
120 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
121 # Works like a conventional assert method does, but reports failures
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
122 # using [error] instead of [exit]. If -v is used, it reports passing
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
123 # assertions to stderr. $script is evaluated in the caller's scope as
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
124 # an argument to [expr].
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
125 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
126 proc affirm {args} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
127 tailcall test__affert 0 {*}$args
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
128 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
129
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
130 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
131 # @assert ?-v? script ?msg?
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
132 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
133 # Works like [affirm] but exits on error.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
134 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
135 proc assert {args} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
136 tailcall test__affert 1 {*}$args
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
137 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
138
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
139 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
140 # @assert-matches ?-e? pattern ?-e? rhs ?msg?
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
141 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
142 # Equivalent to assert {[string match $pattern $rhs]} except that
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
143 # if either of those are prefixed with an -e flag, they are eval'd
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
144 # and their results are used.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
145 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
146 proc assert-matches {args} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
147 set evalLhs 0
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
148 set evalRhs 0
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
149 if {"-e" eq [lindex $args 0]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
150 incr evalLhs
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
151 set args [lassign $args -]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
152 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
153 set args [lassign $args pattern]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
154 if {"-e" eq [lindex $args 0]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
155 incr evalRhs
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
156 set args [lassign $args -]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
157 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
158 set args [lassign $args rhs msg]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
159
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
160 if {$evalLhs} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
161 set pattern [uplevel 1 $pattern]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
162 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
163 if {$evalRhs} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
164 set rhs [uplevel 1 $rhs]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
165 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
166 #puts "***pattern=$pattern\n***rhs=$rhs"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
167 tailcall test__affert 1 \
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
168 [join [list \[ string match [list $pattern] [list $rhs] \]]] $msg
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
169 # why does this not work? [list \[ string match [list $pattern] [list $rhs] \]] $msg
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
170 # "\[string match [list $pattern] [list $rhs]\]"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
171 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
172
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
173 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
174 # @test-assert testId script ?msg?
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
175 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
176 # Works like [assert] but emits $testId to stdout first.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
177 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
178 proc test-assert {testId script {msg ""}} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
179 puts "test $testId"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
180 tailcall test__affert 1 $script $msg
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
181 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
182
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
183 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
184 # @test-expect testId script result
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
185 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
186 # Runs $script in the calling scope and compares its result to
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
187 # $result, minus any leading or trailing whitespace. If they differ,
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
188 # it triggers an [assert].
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
189 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
190 proc test-expect {testId script result} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
191 puts "test $testId"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
192 set x [string trim [uplevel 1 $script]]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
193 set result [string trim $result]
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
194 tailcall test__affert 0 [list "{$x}" eq "{$result}"] \
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
195 "\nEXPECTED: <<$result>>\nGOT: <<$x>>"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
196 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
197
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
198 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
199 # @test-catch cmd ?...args?
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
200 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
201 # Runs [cmd ...args], repressing any exception except to possibly log
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
202 # the failure. Returns 1 if it caught anything, 0 if it didn't.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
203 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
204 proc test-catch {cmd args} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
205 if {[catch {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
206 uplevel 1 $cmd {*}$args
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
207 } rc xopts]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
208 puts "[test-current-scope] ignoring failure of: $cmd [lindex $args 0]: $rc"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
209 return 1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
210 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
211 return 0
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
212 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
213
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
214 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
215 # @test-catch-matching pattern (script|cmd args...)
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
216 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
217 # Works like test-catch, but it expects its argument(s) to to throw an
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
218 # error matching the given string (checked with [string match]). If
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
219 # they do not throw, or the error does not match $pattern, this
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
220 # function throws, else it returns 1.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
221 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
222 # If there is no second argument, the $cmd is assumed to be a script,
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
223 # and will be eval'd in the caller's scope.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
224 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
225 # TODO: add -glob and -regex flags to control matching flavor.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
226 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
227 proc test-catch-matching {pattern cmd args} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
228 if {[catch {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
229 #puts "**** catch-matching cmd=$cmd args=$args"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
230 if {0 == [llength $args]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
231 uplevel 1 $cmd {*}$args
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
232 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
233 $cmd {*}$args
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
234 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
235 } rc xopts]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
236 if {[string match $pattern $rc]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
237 return 1
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
238 } else {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
239 error "[test-current-scope] exception does not match {$pattern}: {$rc}"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
240 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
241 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
242 error "[test-current-scope] expecting to see an error matching {$pattern}"
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
243 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
244
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
245 if {![array exists ::teaish__BuildFlags]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
246 array set ::teaish__BuildFlags {}
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
247 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
248
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
249 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
250 # @teaish-build-flag3 flag tgtVar ?dflt?
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
251 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
252 # If the current build has the configure-time flag named $flag set
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
253 # then tgtVar is assigned its value and 1 is returned, else tgtVal is
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
254 # assigned $dflt and 0 is returned.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
255 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
256 # Caveat #1: only valid when called in the context of teaish's default
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
257 # "make test" recipe, e.g. from teaish.test.tcl. It is not valid from
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
258 # a teaish.tcl configure script because (A) the state it relies on
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
259 # doesn't fully exist at that point and (B) that level of the API has
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
260 # more direct access to the build state. This function requires that
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
261 # an external script have populated its internal state, which is
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
262 # normally handled via teaish.tester.tcl.in.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
263 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
264 # Caveat #2: defines in the style of HAVE_FEATURENAME with a value of
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
265 # 0 are, by long-standing configure script conventions, treated as
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
266 # _undefined_ here.
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
267 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
268 proc teaish-build-flag3 {flag tgtVar {dflt ""}} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
269 upvar $tgtVar tgt
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
270 if {[info exists ::teaish__BuildFlags($flag)]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
271 set tgt $::teaish__BuildFlags($flag)
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
272 return 1;
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
273 } elseif {0==[array size ::teaish__BuildFlags]} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
274 test-warn \
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
275 "\[[test-current-scope]] was called from " \
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
276 "[test-current-scope 1] without the build flags imported."
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
277 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
278 set tgt $dflt
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
279 return 0
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
280 }
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
281
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
282 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
283 # @teaish-build-flag flag ?dflt?
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
284 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
285 # Convenience form of teaish-build-flag3 which returns the
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
286 # configure-time-defined value of $flag or "" if it's not defined (or
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
287 # if it's an empty string).
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
288 #
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
289 proc teaish-build-flag {flag {dflt ""}} {
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
290 set tgt ""
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
291 teaish-build-flag3 $flag tgt $dflt
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
292 return $tgt
589bab390fb4 [ThirdParty] Added sqlite3 to the third_party.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
293 }