os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/eval.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/eval.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,75 @@
     1.4 +# Commands covered:  eval
     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: eval.test,v 1.5 2000/04/10 17:18:58 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 +test eval-1.1 {single argument} {
    1.25 +    eval {format 22}
    1.26 +} 22
    1.27 +test eval-1.2 {multiple arguments} {
    1.28 +    set a {$b}
    1.29 +    set b xyzzy
    1.30 +    eval format $a
    1.31 +} xyzzy
    1.32 +test eval-1.3 {single argument} {
    1.33 +    eval concat a b c d e f g
    1.34 +} {a b c d e f g}
    1.35 +
    1.36 +test eval-2.1 {error: not enough arguments} {catch eval} 1
    1.37 +test eval-2.2 {error: not enough arguments} {
    1.38 +    catch eval msg
    1.39 +    set msg
    1.40 +} {wrong # args: should be "eval arg ?arg ...?"}
    1.41 +test eval-2.3 {error in eval'ed command} {
    1.42 +    catch {eval {error "test error"}}
    1.43 +} 1
    1.44 +test eval-2.4 {error in eval'ed command} {
    1.45 +    catch {eval {error "test error"}} msg
    1.46 +    set msg
    1.47 +} {test error}
    1.48 +test eval-2.5 {error in eval'ed command: setting errorInfo} {
    1.49 +    catch {eval {
    1.50 +	set a 1
    1.51 +	error "test error"
    1.52 +    }} msg
    1.53 +    set errorInfo
    1.54 +} "test error
    1.55 +    while executing
    1.56 +\"error \"test error\"\"
    1.57 +    (\"eval\" body line 3)
    1.58 +    invoked from within
    1.59 +\"eval {
    1.60 +	set a 1
    1.61 +	error \"test error\"
    1.62 +    }\""
    1.63 +
    1.64 +# cleanup
    1.65 +::tcltest::cleanupTests
    1.66 +return
    1.67 +
    1.68 +
    1.69 +
    1.70 +
    1.71 +
    1.72 +
    1.73 +
    1.74 +
    1.75 +
    1.76 +
    1.77 +
    1.78 +