os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/result.test
First public contribution.
1 # This file tests the routines in tclResult.c.
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.
7 # Copyright (c) 1997 by Sun Microsystems, Inc.
8 # Copyright (c) 1998-1999 by Scriptics Corporation.
10 # See the file "license.terms" for information on usage and redistribution
11 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 # SCCS: @(#) result.test 1.4 97/12/08 15:07:49
15 if {[lsearch [namespace children] ::tcltest] == -1} {
16 package require tcltest 2
17 namespace import -force ::tcltest::*
20 # Some tests require the testsaveresult command
22 ::tcltest::testConstraint testsaveresult \
23 [expr {[info commands testsaveresult] != {}}]
25 test result-1.1 {Tcl_SaveInterpResult} {testsaveresult} {
26 testsaveresult small {set x 42} 0
28 test result-1.2 {Tcl_SaveInterpResult} {testsaveresult} {
29 testsaveresult append {set x 42} 0
31 test result-1.3 {Tcl_SaveInterpResult} {testsaveresult} {
32 testsaveresult dynamic {set x 42} 0
33 } {dynamic result notCalled present}
34 test result-1.4 {Tcl_SaveInterpResult} {testsaveresult} {
35 testsaveresult object {set x 42} 0
36 } {object result same}
37 test result-1.5 {Tcl_SaveInterpResult} {testsaveresult} {
38 testsaveresult small {set x 42} 1
40 test result-1.6 {Tcl_SaveInterpResult} {testsaveresult} {
41 testsaveresult append {set x 42} 1
43 test result-1.7 {Tcl_SaveInterpResult} {testsaveresult} {
44 testsaveresult dynamic {set x 42} 1
46 test result-1.8 {Tcl_SaveInterpResult} {testsaveresult} {
47 testsaveresult object {set x 42} 1
51 # Tcl_RestoreInterpResult is mostly tested by the previous tests except
52 # for the following case
54 test result-2.1 {Tcl_RestoreInterpResult} {testsaveresult} {
55 testsaveresult append {cd _foobar} 0
58 # Tcl_DiscardInterpResult is mostly tested by the previous tests except
59 # for the following cases
61 test result-3.1 {Tcl_DiscardInterpResult} {testsaveresult} {
62 list [catch {testsaveresult append {cd _foobar} 1} msg] $msg
63 } {1 {couldn't change working directory to "_foobar": no such file or directory}}
64 test result-3.2 {Tcl_DiscardInterpResult} {testsaveresult} {
65 testsaveresult free {set x 42} 1
68 ::tcltest::testConstraint testsetobjerrorcode \
69 [expr {[info commands testsetobjerrorcode] != {}}]
71 test result-4.1 {Tcl_SetObjErrorCode - one arg} {testsetobjerrorcode} {
72 catch {testsetobjerrorcode 1}
75 test result-4.2 {Tcl_SetObjErrorCode - two args} {testsetobjerrorcode} {
76 catch {testsetobjerrorcode 1 2}
79 test result-4.3 {Tcl_SetObjErrorCode - three args} {testsetobjerrorcode} {
80 catch {testsetobjerrorcode 1 2 3}
83 test result-4.4 {Tcl_SetObjErrorCode - four args} {testsetobjerrorcode} {
84 catch {testsetobjerrorcode 1 2 3 4}
87 test result-4.5 {Tcl_SetObjErrorCode - five args} {testsetobjerrorcode} {
88 catch {testsetobjerrorcode 1 2 3 4 5}
92 ::tcltest::testConstraint testseterrorcode \
93 [expr {[info commands testseterrorcode] != {}}]
95 test result-5.1 {Tcl_SetErrorCode - one arg} testseterrorcode {
96 catch {testseterrorcode 1}
99 test result-5.2 {Tcl_SetErrorCode - one arg, list quoting} testseterrorcode {
100 catch {testseterrorcode {a b}}
103 test result-5.3 {Tcl_SetErrorCode - one arg, list quoting} testseterrorcode {
104 catch {testseterrorcode \{}
107 test result-5.4 {Tcl_SetErrorCode - two args, list quoting} testseterrorcode {
108 catch {testseterrorcode {a b} c}
113 ::tcltest::cleanupTests