diff options
Diffstat (limited to 'tests/case.test')
| -rw-r--r-- | tests/case.test | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/case.test b/tests/case.test index e36b3b3..6d63cea 100644 --- a/tests/case.test +++ b/tests/case.test @@ -6,13 +6,15 @@ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. +# Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -# -# RCS: @(#) $Id: case.test,v 1.2 1998/09/14 18:40:07 stanton Exp $ -if {[string compare test [info procs test]] == 1} then {source defs} +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest + namespace import -force ::tcltest::* +} test case-1.1 {simple pattern} { case a in a {format 1} b {format 2} c {format 3} default {format 4} @@ -38,7 +40,7 @@ test case-1.7 {list of patterns} { test case-2.1 {error in executed command} { list [catch {case a in a {error "Just a test"} default {format 1}} msg] \ - $msg $errorInfo + $msg $::errorInfo } {1 {Just a test} {Just a test while executing "error "Just a test"" @@ -47,7 +49,7 @@ test case-2.1 {error in executed command} { "case a in a {error "Just a test"} default {format 1}"}} test case-2.2 {error: not enough args} { list [catch {case} msg] $msg -} {1 {wrong # args: should be "case string ?in? patList body ... ?default body?"}} +} {1 {wrong # args: should be "case string ?in? ?pattern body ...? ?default body?"}} test case-2.3 {error: pattern with no body} { list [catch {case a b} msg] $msg } {1 {extra case pattern with no body}} @@ -56,7 +58,7 @@ test case-2.4 {error: pattern with no body} { } {1 {extra case pattern with no body}} test case-2.5 {error in default command} { list [catch {case foo in a {error case1} default {error case2} \ - b {error case 3}} msg] $msg $errorInfo + b {error case 3}} msg] $msg $::errorInfo } {1 case2 {case2 while executing "error case2" @@ -81,3 +83,7 @@ test case-3.2 {single-argument form for pattern/command pairs} { test case-3.3 {single-argument form for pattern/command pairs} { list [catch {case z in {a 2 b}} msg] $msg } {1 {extra case pattern with no body}} + +# cleanup +::tcltest::cleanupTests +return |
