summaryrefslogtreecommitdiffstats
path: root/tests/source.test
diff options
context:
space:
mode:
authorstanton <stanton>1999-04-16 00:46:29 (GMT)
committerstanton <stanton>1999-04-16 00:46:29 (GMT)
commit97464e6cba8eb0008cf2727c15718671992b913f (patch)
treece9959f2747257d98d52ec8d18bf3b0de99b9535 /tests/source.test
parenta8c96ddb94d1483a9de5e340b740cb74ef6cafa7 (diff)
downloadtcl-97464e6cba8eb0008cf2727c15718671992b913f.zip
tcl-97464e6cba8eb0008cf2727c15718671992b913f.tar.gz
tcl-97464e6cba8eb0008cf2727c15718671992b913f.tar.bz2
merged tcl 8.1 branch back into the main trunk
Diffstat (limited to 'tests/source.test')
-rw-r--r--tests/source.test56
1 files changed, 33 insertions, 23 deletions
diff --git a/tests/source.test b/tests/source.test
index 590188f..74a3589 100644
--- a/tests/source.test
+++ b/tests/source.test
@@ -6,13 +6,16 @@
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
+# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: source.test,v 1.2 1998/09/14 18:40:13 stanton Exp $
+# RCS: @(#) $Id: source.test,v 1.3 1999/04/16 00:47:34 stanton Exp $
-if {[string compare test [info procs test]] == 1} then {source defs}
+if {[lsearch [namespace children] ::tcltest] == -1} {
+ source [file join [pwd] [file dirname [info script]] defs.tcl]
+}
test source-1.1 {source command} {
set x "old x value"
@@ -30,23 +33,19 @@ test source-1.2 {source command} {
makeFile {list result} source.file
source source.file
} result
+test source-1.3 {source command} {
+ set y {\ }
-# The mac version of source returns a different result for
-# the next two tests.
+ set fd [open source.file w]
+ fconfigure $fd -translation lf
+ puts -nonewline $fd "list a b c "
+ puts $fd [string index $y 0]
+ puts $fd "d e f"
+ close $fd
+
+ source source.file
+} {a b c d e f}
-if {$tcl_platform(platform) == "macintosh"} {
- set retMsg1 {1 {wrong # args: should be "source fileName" or "source -rsrc name ?fileName?" or "source -rsrcid id ?fileName?"}}
- set retMsg2 {1 {bad argument: should be "source fileName" or "source -rsrc name ?fileName?" or "source -rsrcid id ?fileName?"}}
-} else {
- set retMsg1 {1 {wrong # args: should be "source fileName"}}
- set retMsg2 {1 {wrong # args: should be "source fileName"}}
-}
-test source-2.1 {source error conditions} {
- list [catch {source} msg] $msg
-} $retMsg1
-test source-2.2 {source error conditions} {
- list [catch {source a b} msg] $msg
-} $retMsg2
test source-2.3 {source error conditions} {
makeFile {
set x 146
@@ -132,13 +131,13 @@ test source-4.2 {source error conditions} {macOnly} {
} [list 1 "expected integer but got \"bad_id\""]
test source-4.3 {source error conditions} {macOnly} {
list [catch {source -rsrc rsrcName fileName extra} msg] $msg
-} $retMsg1
+} {1 {wrong # args: should be "source fileName" or "source -rsrc name ?fileName?" or "source -rsrcid id ?fileName?"}}
test source-4.4 {source error conditions} {macOnly} {
list [catch {source non_switch rsrcName} msg] $msg
-} $retMsg2
+} {1 {bad argument: should be "source fileName" or "source -rsrc name ?fileName?" or "source -rsrcid id ?fileName?"}}
test source-4.5 {source error conditions} {macOnly} {
list [catch {source -bad_switch argument} msg] $msg
-} $retMsg2
+} {1 {bad argument: should be "source fileName" or "source -rsrc name ?fileName?" or "source -rsrcid id ?fileName?"}}
test source-5.1 {source resource files} {macOnly} {
list [catch {source -rsrc rsrcName bad_file} msg] $msg
} [list 1 "Error finding the file: \"bad_file\"."]
@@ -180,8 +179,19 @@ test source-6.1 {source is binary ok} {
string length $x
} 5
-catch {removeFile source.file}
+# cleanup
+catch {::tcltest::removeFile source.file}
+::tcltest::cleanupTests
+return
+
+
+
+
+
+
+
+
+
+
-# Generate null final value
-concat {}