os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/eval.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.
     1 # Commands covered:  eval
     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: eval.test,v 1.5 2000/04/10 17:18:58 ericm Exp $
    15 
    16 if {[lsearch [namespace children] ::tcltest] == -1} {
    17     package require tcltest
    18     namespace import -force ::tcltest::*
    19 }
    20 
    21 test eval-1.1 {single argument} {
    22     eval {format 22}
    23 } 22
    24 test eval-1.2 {multiple arguments} {
    25     set a {$b}
    26     set b xyzzy
    27     eval format $a
    28 } xyzzy
    29 test eval-1.3 {single argument} {
    30     eval concat a b c d e f g
    31 } {a b c d e f g}
    32 
    33 test eval-2.1 {error: not enough arguments} {catch eval} 1
    34 test eval-2.2 {error: not enough arguments} {
    35     catch eval msg
    36     set msg
    37 } {wrong # args: should be "eval arg ?arg ...?"}
    38 test eval-2.3 {error in eval'ed command} {
    39     catch {eval {error "test error"}}
    40 } 1
    41 test eval-2.4 {error in eval'ed command} {
    42     catch {eval {error "test error"}} msg
    43     set msg
    44 } {test error}
    45 test eval-2.5 {error in eval'ed command: setting errorInfo} {
    46     catch {eval {
    47 	set a 1
    48 	error "test error"
    49     }} msg
    50     set errorInfo
    51 } "test error
    52     while executing
    53 \"error \"test error\"\"
    54     (\"eval\" body line 3)
    55     invoked from within
    56 \"eval {
    57 	set a 1
    58 	error \"test error\"
    59     }\""
    60 
    61 # cleanup
    62 ::tcltest::cleanupTests
    63 return
    64 
    65 
    66 
    67 
    68 
    69 
    70 
    71 
    72 
    73 
    74 
    75