os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/unknown.test
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
# Commands covered:  unknown
sl@0
     2
#
sl@0
     3
# This file contains a collection of tests for one or more of the Tcl
sl@0
     4
# built-in commands.  Sourcing this file into Tcl runs the tests and
sl@0
     5
# generates output for errors.  No output means no errors were found.
sl@0
     6
#
sl@0
     7
# Copyright (c) 1991-1993 The Regents of the University of California.
sl@0
     8
# Copyright (c) 1994 Sun Microsystems, Inc.
sl@0
     9
# Copyright (c) 1998-1999 by Scriptics Corporation.
sl@0
    10
#
sl@0
    11
# See the file "license.terms" for information on usage and redistribution
sl@0
    12
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
sl@0
    13
#
sl@0
    14
# RCS: @(#) $Id: unknown.test,v 1.6 2000/04/10 17:19:05 ericm Exp $
sl@0
    15
sl@0
    16
if {[lsearch [namespace children] ::tcltest] == -1} {
sl@0
    17
    package require tcltest
sl@0
    18
    namespace import -force ::tcltest::*
sl@0
    19
}
sl@0
    20
sl@0
    21
catch {unset x}
sl@0
    22
catch {rename unknown unknown.old}
sl@0
    23
sl@0
    24
test unknown-1.1 {non-existent "unknown" command} {
sl@0
    25
    list [catch {_non-existent_ foo bar} msg] $msg
sl@0
    26
} {1 {invalid command name "_non-existent_"}}
sl@0
    27
sl@0
    28
proc unknown {args} {
sl@0
    29
    global x
sl@0
    30
    set x $args
sl@0
    31
}
sl@0
    32
sl@0
    33
test unknown-2.1 {calling "unknown" command} {
sl@0
    34
    foobar x y z
sl@0
    35
    set x
sl@0
    36
} {foobar x y z}
sl@0
    37
test unknown-2.2 {calling "unknown" command with lots of args} {
sl@0
    38
    foobar 1 2 3 4 5 6 7
sl@0
    39
    set x
sl@0
    40
} {foobar 1 2 3 4 5 6 7}
sl@0
    41
test unknown-2.3 {calling "unknown" command with lots of args} {
sl@0
    42
    foobar 1 2 3 4 5 6 7 8
sl@0
    43
    set x
sl@0
    44
} {foobar 1 2 3 4 5 6 7 8}
sl@0
    45
test unknown-2.4 {calling "unknown" command with lots of args} {
sl@0
    46
    foobar 1 2 3 4 5 6 7 8 9
sl@0
    47
    set x
sl@0
    48
} {foobar 1 2 3 4 5 6 7 8 9}
sl@0
    49
sl@0
    50
test unknown-3.1 {argument quoting in calls to "unknown"} {
sl@0
    51
    foobar \{ \} a\{b \; "\\" \$a a\[b \]
sl@0
    52
    set x
sl@0
    53
} "foobar \\{ \\} a\\{b {;} \\\\ {\$a} {a\[b} \\]"
sl@0
    54
sl@0
    55
proc unknown args {
sl@0
    56
    error "unknown failed"
sl@0
    57
}
sl@0
    58
sl@0
    59
test unknown-4.1 {errors in "unknown" procedure} {
sl@0
    60
    list [catch {non-existent a b} msg] $msg $errorCode
sl@0
    61
} {1 {unknown failed} NONE}
sl@0
    62
sl@0
    63
# cleanup
sl@0
    64
catch {rename unknown {}}
sl@0
    65
catch {rename unknown.old unknown}
sl@0
    66
::tcltest::cleanupTests
sl@0
    67
return 
sl@0
    68
sl@0
    69
sl@0
    70
sl@0
    71
sl@0
    72
sl@0
    73
sl@0
    74
sl@0
    75
sl@0
    76
sl@0
    77
sl@0
    78
sl@0
    79