summaryrefslogtreecommitdiffstats
path: root/tests/parseOld.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/parseOld.test')
-rw-r--r--tests/parseOld.test110
1 files changed, 82 insertions, 28 deletions
diff --git a/tests/parseOld.test b/tests/parseOld.test
index 44aa5d1..c8f82cf 100644
--- a/tests/parseOld.test
+++ b/tests/parseOld.test
@@ -6,20 +6,15 @@
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright © 1991-1993 The Regents of the University of California.
-# Copyright © 1994-1996 Sun Microsystems, Inc.
-# Copyright © 1998-1999 Scriptics Corporation.
+# 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.
-if {"::tcltest" ni [namespace children]} {
- package require tcltest 2.5
- namespace import -force ::tcltest::*
-}
-
-::tcltest::loadTestedCommands
-catch [list package require -exact tcl::test [info patchlevel]]
+package require tcltest
+namespace import ::tcltest::*
testConstraint testwordend [llength [info commands testwordend]]
@@ -38,7 +33,7 @@ proc getArgs args {
global argv
set argv $args
}
-
+
# Basic argument parsing.
test parseOld-1.1 {basic argument parsing} {
@@ -134,7 +129,7 @@ format %s $b
} a22b
test parseOld-4.4 {command substitution} {
set a 7.7
- if {[catch {expr {int($a)}}]} {set a foo}
+ if [catch {expr int($a)}] {set a foo}
set a
} 7.7
@@ -264,14 +259,14 @@ test parseOld-7.11 {backslash substitution} {
eval "list a \"b c\"\\\nd e"
} {a {b c} d e}
test parseOld-7.12 {backslash substitution} {
- expr {[list \uA2] eq "¢"}
-} 1
+ list \ua2
+} [bytestring "\xc2\xa2"]
test parseOld-7.13 {backslash substitution} {
- expr {[list \u4E21] eq "両"}
-} 1
+ list \u4e21
+} [bytestring "\xe4\xb8\xa1"]
test parseOld-7.14 {backslash substitution} {
- expr {[list \u4E2k] eq "Ӣk"}
-} 1
+ list \u4e2k
+} [bytestring "\xd3\xa2k"]
# Semi-colon.
@@ -297,7 +292,6 @@ test parseOld-8.4 {semi-colons} {
# The following checks are to ensure that the interpreter's result
# gets re-initialized by Tcl_Eval in all the right places.
-set a 22
test parseOld-9.1 {result initialization} {concat abc} abc
test parseOld-9.2 {result initialization} {concat abc; proc foo {} {}} {}
test parseOld-9.3 {result initialization} {concat abc; proc foo {} $a} {}
@@ -410,8 +404,6 @@ test parseOld-11.7 {long values} {
set b [concat 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH]
llength $b
} 43
-# Duplicate action of previous test
-llength [set b [concat 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH]]
test parseOld-11.8 {long values} {
set b
} $a
@@ -454,14 +446,80 @@ test parseOld-12.4 {comments} {
test parseOld-13.1 {comments at the end of a bracketed script} {
set x "[
-expr {1+1}
+expr 1+1
# skip this!
]"
} {2}
+test parseOld-14.1 {TclWordEnd procedure} {testwordend} {
+ testwordend " \n abc"
+} {c}
+test parseOld-14.2 {TclWordEnd procedure} {testwordend} {
+ testwordend " \\\n"
+} {}
+test parseOld-14.3 {TclWordEnd procedure} {testwordend} {
+ testwordend " \\\n "
+} { }
+test parseOld-14.4 {TclWordEnd procedure} {testwordend} {
+ testwordend {"abc"}
+} {"}
+#" Emacs formatting :^(
+test parseOld-14.5 {TclWordEnd procedure} {testwordend} {
+ testwordend {{xyz}}
+} \}
+test parseOld-14.6 {TclWordEnd procedure} {testwordend} {
+ testwordend {{a{}b{}\}} xyz}
+} "\} xyz"
+test parseOld-14.7 {TclWordEnd procedure} {testwordend} {
+ testwordend {abc[this is a]def ghi}
+} {f ghi}
+test parseOld-14.8 {TclWordEnd procedure} {testwordend} {
+ testwordend "puts\\\n\n "
+} "s\\\n\n "
+test parseOld-14.9 {TclWordEnd procedure} {testwordend} {
+ testwordend "puts\\\n "
+} "s\\\n "
+test parseOld-14.10 {TclWordEnd procedure} {testwordend} {
+ testwordend "puts\\\n xyz"
+} "s\\\n xyz"
+test parseOld-14.11 {TclWordEnd procedure} {testwordend} {
+ testwordend {a$x.$y(a long index) foo}
+} ") foo"
+test parseOld-14.12 {TclWordEnd procedure} {testwordend} {
+ testwordend {abc; def}
+} {; def}
+test parseOld-14.13 {TclWordEnd procedure} {testwordend} {
+ testwordend {abc def}
+} {c def}
+test parseOld-14.14 {TclWordEnd procedure} {testwordend} {
+ testwordend {abc def}
+} {c def}
+test parseOld-14.15 {TclWordEnd procedure} {testwordend} {
+ testwordend "abc\ndef"
+} "c\ndef"
+test parseOld-14.16 {TclWordEnd procedure} {testwordend} {
+ testwordend "abc"
+} {c}
+test parseOld-14.17 {TclWordEnd procedure} {testwordend} {
+ testwordend "a\000bc"
+} {c}
+test parseOld-14.18 {TclWordEnd procedure} {testwordend} {
+ testwordend \[a\000\]
+} {]}
+test parseOld-14.19 {TclWordEnd procedure} {testwordend} {
+ testwordend \"a\000\"
+} {"}
+#" Emacs formatting :^(
+test parseOld-14.20 {TclWordEnd procedure} {testwordend} {
+ testwordend a{\000}b
+} {b}
+test parseOld-14.21 {TclWordEnd procedure} {testwordend} {
+ testwordend " \000b"
+} {b}
+
test parseOld-15.1 {TclScriptEnd procedure} {
info complete {puts [
- expr {1+1}
+ expr 1+1
#this is a comment ]}
} {0}
test parseOld-15.2 {TclScriptEnd procedure} {
@@ -476,12 +534,8 @@ test parseOld-15.4 {TclScriptEnd procedure} {
test parseOld-15.5 {TclScriptEnd procedure} {
info complete "xyz \[abc"
} {0}
-
+
# cleanup
set argv $savedArgv
::tcltest::cleanupTests
return
-
-# Local Variables:
-# mode: tcl
-# End: