summaryrefslogtreecommitdiffstats
path: root/tests/set-old.test
diff options
context:
space:
mode:
authorericm <ericm>2000-05-31 15:03:33 (GMT)
committerericm <ericm>2000-05-31 15:03:33 (GMT)
commitfb987e05c7e3613f4a27e0f9262e29cbda36e51a (patch)
tree4cfa67e5a1c015cdda900b630930eca88d75bf28 /tests/set-old.test
parent15694426fe8aee1201ebb7357f86aafb07fad4fd (diff)
downloadtcl-fb987e05c7e3613f4a27e0f9262e29cbda36e51a.zip
tcl-fb987e05c7e3613f4a27e0f9262e29cbda36e51a.tar.gz
tcl-fb987e05c7e3613f4a27e0f9262e29cbda36e51a.tar.bz2
* generic/tclVar.c (Tcl_ArrayObjCmd): Added support for regexp and
exact matching for [array names] command. [RFE: 3684]. * doc/array.n: Added documentation for [array names -exact/-regexp/-glob] [RFE: 3684]. * tests/set-old.test: Added tests for [array names -exact/-regexp/-glob] [RFE: 3684].
Diffstat (limited to 'tests/set-old.test')
-rw-r--r--tests/set-old.test45
1 files changed, 43 insertions, 2 deletions
diff --git a/tests/set-old.test b/tests/set-old.test
index 888a6aa..d9f4084 100644
--- a/tests/set-old.test
+++ b/tests/set-old.test
@@ -13,7 +13,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: set-old.test,v 1.9 2000/05/08 21:25:31 ericm Exp $
+# RCS: @(#) $Id: set-old.test,v 1.10 2000/05/31 15:03:35 ericm Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -388,7 +388,7 @@ test set-old-8.22 {array command, names option} {
catch {unset a}
set a(22) 3
list [catch {array names a 4 5} msg] $msg
-} {1 {wrong # args: should be "array names arrayName ?pattern?"}}
+} {1 {bad option "4": must be -exact, -glob, or -regexp}}
test set-old-8.19 {array command, names option} {
catch {unset a}
array names a
@@ -589,6 +589,47 @@ number of buckets with 8 entries: 0
number of buckets with 9 entries: 0
number of buckets with 10 or more entries: 0
average search distance for entry: 1.7"
+test set-old-8.49 {array command, array names -exact on glob pattern} {
+ catch {unset a}
+ set a(1*2) 1
+ list [catch {array names a -exact 1*2} msg] $msg
+} {0 1*2}
+test set-old-8.48 {array command, array names -glob on glob pattern} {
+ catch {unset a}
+ set a(1*2) 1
+ set a(12) 1
+ set a(11) 1
+ list [catch {lsort [array names a -glob 1*2]} msg] $msg
+} {0 {1*2 12}}
+test set-old-8.49 {array command, array names -regexp on regexp pattern} {
+ catch {unset a}
+ set a(1*2) 1
+ set a(12) 1
+ set a(11) 1
+ list [catch {lsort [array names a -regexp ^1]} msg] $msg
+} {0 {1*2 11 12}}
+test set-old-8.50 {array command, array names -regexp} {
+ catch {unset a}
+ set a(-glob) 1
+ set a(-regexp) 1
+ set a(-exact) 1
+ list [catch {array names a -regexp} msg] $msg
+} {0 -regexp}
+test set-old-8.51 {array command, array names -exact} {
+ catch {unset a}
+ set a(-glob) 1
+ set a(-regexp) 1
+ set a(-exact) 1
+ list [catch {array names a -exact} msg] $msg
+} {0 -exact}
+test set-old-8.52 {array command, array names -glob} {
+ catch {unset a}
+ set a(-glob) 1
+ set a(-regexp) 1
+ set a(-exact) 1
+ list [catch {array names a -glob} msg] $msg
+} {0 -glob}
+
test set-old-9.1 {ids for array enumeration} {
catch {unset a}