aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-12-06 20:21:37 +1000
committerSteve Bennett <steveb@workware.net.au>2010-12-06 21:01:32 +1000
commit3fb099f57df1392661a2f49f3437759b73d36065 (patch)
treea82940320ef47ff1a3b9c9a9758fa0f4ee7acab3 /tests
parentb0a046eee1c2f91d96d7077a6a5bd3ba07076e64 (diff)
downloadjimtcl-3fb099f57df1392661a2f49f3437759b73d36065.zip
jimtcl-3fb099f57df1392661a2f49f3437759b73d36065.tar.gz
jimtcl-3fb099f57df1392661a2f49f3437759b73d36065.tar.bz2
Add more dependencies for tests
Allow tests to run with almost all features disabled
Diffstat (limited to 'tests')
-rw-r--r--tests/alias.test1
-rw-r--r--tests/array.test2
-rw-r--r--tests/error.test2
-rw-r--r--tests/filecopy.test5
-rw-r--r--tests/lsearch.test9
-rw-r--r--tests/misc.test2
-rw-r--r--tests/pid.test6
-rw-r--r--tests/proc-new.test1
-rw-r--r--tests/proc.test1
-rw-r--r--tests/stacktrace.test2
-rw-r--r--tests/tailcall.test1
-rw-r--r--tests/testing.tcl7
-rw-r--r--tests/upvar.test2
13 files changed, 32 insertions, 9 deletions
diff --git a/tests/alias.test b/tests/alias.test
index e0e2775..eba34b0 100644
--- a/tests/alias.test
+++ b/tests/alias.test
@@ -1,6 +1,7 @@
source [file dirname [info script]]/testing.tcl
needs constraint jim
+needs cmd array
test alias-1.1 "One word alias" {
set x 2
diff --git a/tests/array.test b/tests/array.test
index efc875c..408c4e3 100644
--- a/tests/array.test
+++ b/tests/array.test
@@ -1,5 +1,7 @@
source [file dirname [info script]]/testing.tcl
+needs cmd array
+
array set a {
1 one
2 two
diff --git a/tests/error.test b/tests/error.test
index 54d1731..65dd506 100644
--- a/tests/error.test
+++ b/tests/error.test
@@ -1,5 +1,5 @@
source [file dirname [info script]]/testing.tcl
-needs constraint jim
+needs constraint jim; needs cmd package
proc a {} {
error "error thrown from a"
}
diff --git a/tests/filecopy.test b/tests/filecopy.test
index c45b119..c5d097d 100644
--- a/tests/filecopy.test
+++ b/tests/filecopy.test
@@ -1,6 +1,9 @@
source [file dirname [info script]]/testing.tcl
+needs constraint jim
needs cmd file
+needs cmd exec
+needs cmd parray tclcompat
cd $testdir
@@ -61,6 +64,6 @@ test filecopy-2.5 "Source doesn't exist and can't write to target (-force)" {
} {1 {missing: No such file or directory}}
file delete tempfile
-exec rmdir tempdir
+exec rm -rf tempdir
testreport
diff --git a/tests/lsearch.test b/tests/lsearch.test
index 53642c9..1eb6607 100644
--- a/tests/lsearch.test
+++ b/tests/lsearch.test
@@ -15,6 +15,9 @@
source [file dirname [info script]]/testing.tcl
+catch {package require regexp}
+testConstraint regexp [expr {[info commands regexp] ne {}}]
+
set x {abcd bbcd 123 234 345}
test lsearch-1.1 {lsearch command} {
lsearch $x 123
@@ -44,10 +47,10 @@ test lsearch-2.4 {search modes} {
test lsearch-2.5 {search modes} {
lsearch -exact {foo bar cat} bar
} 1
-test lsearch-2.6 {search modes} {
+test lsearch-2.6 {search modes} regexp {
list [catch {lsearch -regexp {xyz bbcc *bc*} *bc*} msg]
} {1}
-test lsearch-2.7 {search modes} {
+test lsearch-2.7 {search modes} regexp {
lsearch -regexp {b.x ^bc xy bcx} ^bc
} 3
test lsearch-2.8 {search modes} {
@@ -59,7 +62,7 @@ test lsearch-2.9 {search modes} {
test lsearch-2.10 {search modes} {
list [catch {lsearch -glib {b.x bx xy bcx} b.x} msg]
} {1}
-test lsearch-2.7 {search modes, -nocase} {
+test lsearch-2.7 {search modes, -nocase} regexp {
lsearch -nocase -regexp {b.x ^bc xy bcx} ^BC
} 3
test lsearch-2.8 {search modes, -nocase} {
diff --git a/tests/misc.test b/tests/misc.test
index ad9dd35..5fb84cb 100644
--- a/tests/misc.test
+++ b/tests/misc.test
@@ -1,6 +1,8 @@
source [file dirname [info script]]/testing.tcl
needs constraint jim
+needs cmd gets tclcompat
+needs cmd array
catch {unset a b}
test regr-1.1 "Double dereference arrays" {
diff --git a/tests/pid.test b/tests/pid.test
index 4ce4d03..0d2449d 100644
--- a/tests/pid.test
+++ b/tests/pid.test
@@ -16,13 +16,15 @@
source [file dirname [info script]]/testing.tcl
needs cmd pid posix
+catch {package require regexp}
+testConstraint regexp [expr {[info commands regexp] ne {}}]
file delete test1
-test pid-1.1 {pid command} {
+test pid-1.1 {pid command} regexp {
regexp {(^[0-9]+$)|(^0x[0-9a-fA-F]+$)} [pid]
} 1
-test pid-1.2 {pid command} {
+test pid-1.2 {pid command} regexp {
set f [open {| echo foo | cat >test1} w]
set pids [pid $f]
close $f
diff --git a/tests/proc-new.test b/tests/proc-new.test
index 077b43e..c771575 100644
--- a/tests/proc-new.test
+++ b/tests/proc-new.test
@@ -1,6 +1,7 @@
source [file dirname [info script]]/testing.tcl
needs constraint jim
+needs cmd array
proc aproc {} {
list
diff --git a/tests/proc.test b/tests/proc.test
index 916893e..00f3ea9 100644
--- a/tests/proc.test
+++ b/tests/proc.test
@@ -19,6 +19,7 @@
source [file dirname [info script]]/testing.tcl
needs constraint jim
+needs cmd array
catch {rename t1 ""}
catch {rename foo ""}
diff --git a/tests/stacktrace.test b/tests/stacktrace.test
index 3f1428c..13028a9 100644
--- a/tests/stacktrace.test
+++ b/tests/stacktrace.test
@@ -1,5 +1,5 @@
source [file dirname [info script]]/testing.tcl
-needs constraint jim
+needs constraint jim; needs cmd package
package require errors
# Make this a proc so that the line numbers don't have to change
proc main {} {
diff --git a/tests/tailcall.test b/tests/tailcall.test
index 7ee18c6..b7dab81 100644
--- a/tests/tailcall.test
+++ b/tests/tailcall.test
@@ -1,6 +1,7 @@
source [file dirname [info script]]/testing.tcl
needs constraint jim
needs cmd tailcall
+needs cmd try tclcompat
test tailcall-1.1 {Basic tailcall} {
# Demo -- a tail-recursive factorial function
diff --git a/tests/testing.tcl b/tests/testing.tcl
index 4bb19a5..9532599 100644
--- a/tests/testing.tcl
+++ b/tests/testing.tcl
@@ -1,5 +1,10 @@
# Common code
-array set testinfo {verbose 0 numpass 0 numfail 0 numskip 0 numtests 0 failed {}}
+set testinfo(verbose) 0
+set testinfo(numpass) 0
+set testinfo(numfail) 0
+set testinfo(numskip) 0
+set testinfo(numtests) 0
+set testinfo(failed) {}
set testdir [file dirname [info script]]
diff --git a/tests/upvar.test b/tests/upvar.test
index 12318e3..91594b0 100644
--- a/tests/upvar.test
+++ b/tests/upvar.test
@@ -15,6 +15,8 @@
source [file dirname [info script]]/testing.tcl
+needs cmd array
+
test upvar-1.1 {reading variables with upvar} {
proc p1 {a b} {set c 22; set d 33; p2}
proc p2 {} {upvar a x1 b x2 c x3 d x4; set a abc; list $x1 $x2 $x3 $x4 $a}