1#!/bin/sh
2#
3# Test tcllib
4
5set kludge { ${1+"$@"}
6shift
7shift
8exec wish -f $0 ${1+"$@"}
9}
10
11# Initialization
12
13set auto_path [concat [list .] $auto_path]
14set icon_path [list .]
15
16source class.tcl
17
18message .msg -aspect 400 -relief raised -bd 1 -text [join {
19    {Click on the attached buttons to run various tests.}
20    {Use the "Quit" button to exit.}
21}]
22
23make_buttons .bot {} {
24    {{Run all}		{foreach f $tests {run_script $f}}}
25    {{Quit}		{destroy .}}
26}
27
28frame .buttons -relief flat -bd 2
29
30set i 0
31set tests {}
32set buttons {}
33foreach f [lsort [glob -nocomplain tests/*.tcl]] {
34    button .b$i -text [file tail $f] -command [list run_script $f] -bd 1
35
36    lappend buttons .b$i
37    lappend tests $f
38    incr i
39}
40
41foreach b $buttons {
42    $b configure -anchor w
43    pack $b -in .buttons -side top -fill x -expand 1 -anchor w
44}
45
46pack .buttons -side right -fill y
47pack .msg -side top -fill both -expand 1
48
49pack .bot -side bottom -fill x
50
51proc run_script {f} {
52    if [catch {source $f} msg] {
53	puts stderr $msg
54    }
55}
56