os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/result.test
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/result.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,126 @@
1.4 +# This file tests the routines in tclResult.c.
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) 1997 by Sun Microsystems, Inc.
1.11 +# Copyright (c) 1998-1999 by Scriptics Corporation.
1.12 +#
1.13 +# See the file "license.terms" for information on usage and redistribution
1.14 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1.15 +#
1.16 +# SCCS: @(#) result.test 1.4 97/12/08 15:07:49
1.17 +
1.18 +if {[lsearch [namespace children] ::tcltest] == -1} {
1.19 + package require tcltest 2
1.20 + namespace import -force ::tcltest::*
1.21 +}
1.22 +
1.23 +# Some tests require the testsaveresult command
1.24 +
1.25 +::tcltest::testConstraint testsaveresult \
1.26 + [expr {[info commands testsaveresult] != {}}]
1.27 +
1.28 +test result-1.1 {Tcl_SaveInterpResult} {testsaveresult} {
1.29 + testsaveresult small {set x 42} 0
1.30 +} {small result}
1.31 +test result-1.2 {Tcl_SaveInterpResult} {testsaveresult} {
1.32 + testsaveresult append {set x 42} 0
1.33 +} {append result}
1.34 +test result-1.3 {Tcl_SaveInterpResult} {testsaveresult} {
1.35 + testsaveresult dynamic {set x 42} 0
1.36 +} {dynamic result notCalled present}
1.37 +test result-1.4 {Tcl_SaveInterpResult} {testsaveresult} {
1.38 + testsaveresult object {set x 42} 0
1.39 +} {object result same}
1.40 +test result-1.5 {Tcl_SaveInterpResult} {testsaveresult} {
1.41 + testsaveresult small {set x 42} 1
1.42 +} {42}
1.43 +test result-1.6 {Tcl_SaveInterpResult} {testsaveresult} {
1.44 + testsaveresult append {set x 42} 1
1.45 +} {42}
1.46 +test result-1.7 {Tcl_SaveInterpResult} {testsaveresult} {
1.47 + testsaveresult dynamic {set x 42} 1
1.48 +} {42 called missing}
1.49 +test result-1.8 {Tcl_SaveInterpResult} {testsaveresult} {
1.50 + testsaveresult object {set x 42} 1
1.51 +} {42 different}
1.52 +
1.53 +
1.54 +# Tcl_RestoreInterpResult is mostly tested by the previous tests except
1.55 +# for the following case
1.56 +
1.57 +test result-2.1 {Tcl_RestoreInterpResult} {testsaveresult} {
1.58 + testsaveresult append {cd _foobar} 0
1.59 +} {append result}
1.60 +
1.61 +# Tcl_DiscardInterpResult is mostly tested by the previous tests except
1.62 +# for the following cases
1.63 +
1.64 +test result-3.1 {Tcl_DiscardInterpResult} {testsaveresult} {
1.65 + list [catch {testsaveresult append {cd _foobar} 1} msg] $msg
1.66 +} {1 {couldn't change working directory to "_foobar": no such file or directory}}
1.67 +test result-3.2 {Tcl_DiscardInterpResult} {testsaveresult} {
1.68 + testsaveresult free {set x 42} 1
1.69 +} {42}
1.70 +
1.71 +::tcltest::testConstraint testsetobjerrorcode \
1.72 + [expr {[info commands testsetobjerrorcode] != {}}]
1.73 +
1.74 +test result-4.1 {Tcl_SetObjErrorCode - one arg} {testsetobjerrorcode} {
1.75 + catch {testsetobjerrorcode 1}
1.76 + list [set errorCode]
1.77 +} {1}
1.78 +test result-4.2 {Tcl_SetObjErrorCode - two args} {testsetobjerrorcode} {
1.79 + catch {testsetobjerrorcode 1 2}
1.80 + list [set errorCode]
1.81 +} {{1 2}}
1.82 +test result-4.3 {Tcl_SetObjErrorCode - three args} {testsetobjerrorcode} {
1.83 + catch {testsetobjerrorcode 1 2 3}
1.84 + list [set errorCode]
1.85 +} {{1 2 3}}
1.86 +test result-4.4 {Tcl_SetObjErrorCode - four args} {testsetobjerrorcode} {
1.87 + catch {testsetobjerrorcode 1 2 3 4}
1.88 + list [set errorCode]
1.89 +} {{1 2 3 4}}
1.90 +test result-4.5 {Tcl_SetObjErrorCode - five args} {testsetobjerrorcode} {
1.91 + catch {testsetobjerrorcode 1 2 3 4 5}
1.92 + list [set errorCode]
1.93 +} {{1 2 3 4 5}}
1.94 +
1.95 +::tcltest::testConstraint testseterrorcode \
1.96 + [expr {[info commands testseterrorcode] != {}}]
1.97 +
1.98 +test result-5.1 {Tcl_SetErrorCode - one arg} testseterrorcode {
1.99 + catch {testseterrorcode 1}
1.100 + set errorCode
1.101 +} 1
1.102 +test result-5.2 {Tcl_SetErrorCode - one arg, list quoting} testseterrorcode {
1.103 + catch {testseterrorcode {a b}}
1.104 + set errorCode
1.105 +} {{a b}}
1.106 +test result-5.3 {Tcl_SetErrorCode - one arg, list quoting} testseterrorcode {
1.107 + catch {testseterrorcode \{}
1.108 + llength $errorCode
1.109 +} 1
1.110 +test result-5.4 {Tcl_SetErrorCode - two args, list quoting} testseterrorcode {
1.111 + catch {testseterrorcode {a b} c}
1.112 + set errorCode
1.113 +} {{a b} c}
1.114 +
1.115 +# cleanup
1.116 +::tcltest::cleanupTests
1.117 +return
1.118 +
1.119 +
1.120 +
1.121 +
1.122 +
1.123 +
1.124 +
1.125 +
1.126 +
1.127 +
1.128 +
1.129 +