os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/eval.test
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
# Commands covered:  eval
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: eval.test,v 1.5 2000/04/10 17:18:58 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
test eval-1.1 {single argument} {
sl@0
    22
    eval {format 22}
sl@0
    23
} 22
sl@0
    24
test eval-1.2 {multiple arguments} {
sl@0
    25
    set a {$b}
sl@0
    26
    set b xyzzy
sl@0
    27
    eval format $a
sl@0
    28
} xyzzy
sl@0
    29
test eval-1.3 {single argument} {
sl@0
    30
    eval concat a b c d e f g
sl@0
    31
} {a b c d e f g}
sl@0
    32
sl@0
    33
test eval-2.1 {error: not enough arguments} {catch eval} 1
sl@0
    34
test eval-2.2 {error: not enough arguments} {
sl@0
    35
    catch eval msg
sl@0
    36
    set msg
sl@0
    37
} {wrong # args: should be "eval arg ?arg ...?"}
sl@0
    38
test eval-2.3 {error in eval'ed command} {
sl@0
    39
    catch {eval {error "test error"}}
sl@0
    40
} 1
sl@0
    41
test eval-2.4 {error in eval'ed command} {
sl@0
    42
    catch {eval {error "test error"}} msg
sl@0
    43
    set msg
sl@0
    44
} {test error}
sl@0
    45
test eval-2.5 {error in eval'ed command: setting errorInfo} {
sl@0
    46
    catch {eval {
sl@0
    47
	set a 1
sl@0
    48
	error "test error"
sl@0
    49
    }} msg
sl@0
    50
    set errorInfo
sl@0
    51
} "test error
sl@0
    52
    while executing
sl@0
    53
\"error \"test error\"\"
sl@0
    54
    (\"eval\" body line 3)
sl@0
    55
    invoked from within
sl@0
    56
\"eval {
sl@0
    57
	set a 1
sl@0
    58
	error \"test error\"
sl@0
    59
    }\""
sl@0
    60
sl@0
    61
# cleanup
sl@0
    62
::tcltest::cleanupTests
sl@0
    63
return
sl@0
    64
sl@0
    65
sl@0
    66
sl@0
    67
sl@0
    68
sl@0
    69
sl@0
    70
sl@0
    71
sl@0
    72
sl@0
    73
sl@0
    74
sl@0
    75