Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/tests/unknown.test @ 68

Last change on this file since 68 was 25, checked in by landauf, 16 years ago

added tcl to libs

File size: 1.9 KB
Line 
1# Commands covered:  unknown
2#
3# This file contains a collection of tests for one or more of the Tcl
4# built-in commands.  Sourcing this file into Tcl runs the tests and
5# generates output for errors.  No output means no errors were found.
6#
7# Copyright (c) 1991-1993 The Regents of the University of California.
8# Copyright (c) 1994 Sun Microsystems, Inc.
9# Copyright (c) 1998-1999 by Scriptics Corporation.
10#
11# See the file "license.terms" for information on usage and redistribution
12# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13#
14# RCS: @(#) $Id: unknown.test,v 1.7 2004/05/19 13:05:37 dkf Exp $
15
16if {[lsearch [namespace children] ::tcltest] == -1} {
17    package require tcltest
18    namespace import -force ::tcltest::*
19}
20
21catch {unset x}
22catch {rename unknown unknown.old}
23
24test unknown-1.1 {non-existent "unknown" command} {
25    list [catch {_non-existent_ foo bar} msg] $msg
26} {1 {invalid command name "_non-existent_"}}
27
28proc unknown {args} {
29    global x
30    set x $args
31}
32
33test unknown-2.1 {calling "unknown" command} {
34    foobar x y z
35    set x
36} {foobar x y z}
37test unknown-2.2 {calling "unknown" command with lots of args} {
38    foobar 1 2 3 4 5 6 7
39    set x
40} {foobar 1 2 3 4 5 6 7}
41test unknown-2.3 {calling "unknown" command with lots of args} {
42    foobar 1 2 3 4 5 6 7 8
43    set x
44} {foobar 1 2 3 4 5 6 7 8}
45test unknown-2.4 {calling "unknown" command with lots of args} {
46    foobar 1 2 3 4 5 6 7 8 9
47    set x
48} {foobar 1 2 3 4 5 6 7 8 9}
49
50test unknown-3.1 {argument quoting in calls to "unknown"} {
51    foobar \{ \} a\{b \; "\\" \$a a\[b \]
52    set x
53} "foobar \\{ \\} a\\{b {;} \\\\ {\$a} {a\[b} \\]"
54
55proc unknown args {
56    error "unknown failed"
57}
58
59test unknown-4.1 {errors in "unknown" procedure} {
60    list [catch {non-existent a b} msg] $msg $errorCode
61} {1 {unknown failed} NONE}
62
63# cleanup
64catch {rename unknown {}}
65catch {rename unknown.old unknown}
66::tcltest::cleanupTests
67return
Note: See TracBrowser for help on using the repository browser.