aboutsummaryrefslogtreecommitdiff
path: root/tcltests/runtests
blob: e93ab02e700f9fc6a1b48944ec82d21324acd90e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh

# \
exec ../tclsh $0

#package require tcl6

proc check {test got exp} {
	if {$got != $exp} {
		error "Failed: $test\nExp: {$exp}\nGot: {$got}"
	}
}
proc verbose {msg} {
	if {$::verbose} {
		puts $msg
	}
}

set verbose [string equal [lindex $argv 0] "-v"]

foreach i [glob test_*.tcl] {
	if {$verbose} {
		puts "======= $i ======="
	} else {
		puts -nonewline "$i..."
		flush stdout
	}
	set rc [catch {source $i} result]
	if {$rc == 7} {
		exit 0
	}
	if {$verbose} {
		puts -nonewline "$i..."
	}
	if {$rc} {
		puts "failed($rc) $result"
		if {$verbose} {
			puts $result
		}
	} elseif {$result ne ""} {
		puts $result
	} else {
		puts "ok"
	}
	if {$verbose} {
		puts ""
	}
}