os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/unknown.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/unknown.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,79 @@
     1.4 +# Commands covered:  unknown
     1.5 +#
     1.6 +# This file contains a collection of tests for one or more of the Tcl
     1.7 +# built-in commands.  Sourcing this file into Tcl runs the tests and
     1.8 +# generates output for errors.  No output means no errors were found.
     1.9 +#
    1.10 +# Copyright (c) 1991-1993 The Regents of the University of California.
    1.11 +# Copyright (c) 1994 Sun Microsystems, Inc.
    1.12 +# Copyright (c) 1998-1999 by Scriptics Corporation.
    1.13 +#
    1.14 +# See the file "license.terms" for information on usage and redistribution
    1.15 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    1.16 +#
    1.17 +# RCS: @(#) $Id: unknown.test,v 1.6 2000/04/10 17:19:05 ericm Exp $
    1.18 +
    1.19 +if {[lsearch [namespace children] ::tcltest] == -1} {
    1.20 +    package require tcltest
    1.21 +    namespace import -force ::tcltest::*
    1.22 +}
    1.23 +
    1.24 +catch {unset x}
    1.25 +catch {rename unknown unknown.old}
    1.26 +
    1.27 +test unknown-1.1 {non-existent "unknown" command} {
    1.28 +    list [catch {_non-existent_ foo bar} msg] $msg
    1.29 +} {1 {invalid command name "_non-existent_"}}
    1.30 +
    1.31 +proc unknown {args} {
    1.32 +    global x
    1.33 +    set x $args
    1.34 +}
    1.35 +
    1.36 +test unknown-2.1 {calling "unknown" command} {
    1.37 +    foobar x y z
    1.38 +    set x
    1.39 +} {foobar x y z}
    1.40 +test unknown-2.2 {calling "unknown" command with lots of args} {
    1.41 +    foobar 1 2 3 4 5 6 7
    1.42 +    set x
    1.43 +} {foobar 1 2 3 4 5 6 7}
    1.44 +test unknown-2.3 {calling "unknown" command with lots of args} {
    1.45 +    foobar 1 2 3 4 5 6 7 8
    1.46 +    set x
    1.47 +} {foobar 1 2 3 4 5 6 7 8}
    1.48 +test unknown-2.4 {calling "unknown" command with lots of args} {
    1.49 +    foobar 1 2 3 4 5 6 7 8 9
    1.50 +    set x
    1.51 +} {foobar 1 2 3 4 5 6 7 8 9}
    1.52 +
    1.53 +test unknown-3.1 {argument quoting in calls to "unknown"} {
    1.54 +    foobar \{ \} a\{b \; "\\" \$a a\[b \]
    1.55 +    set x
    1.56 +} "foobar \\{ \\} a\\{b {;} \\\\ {\$a} {a\[b} \\]"
    1.57 +
    1.58 +proc unknown args {
    1.59 +    error "unknown failed"
    1.60 +}
    1.61 +
    1.62 +test unknown-4.1 {errors in "unknown" procedure} {
    1.63 +    list [catch {non-existent a b} msg] $msg $errorCode
    1.64 +} {1 {unknown failed} NONE}
    1.65 +
    1.66 +# cleanup
    1.67 +catch {rename unknown {}}
    1.68 +catch {rename unknown.old unknown}
    1.69 +::tcltest::cleanupTests
    1.70 +return 
    1.71 +
    1.72 +
    1.73 +
    1.74 +
    1.75 +
    1.76 +
    1.77 +
    1.78 +
    1.79 +
    1.80 +
    1.81 +
    1.82 +