summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>1999-10-30 11:07:53 (GMT)
committerhobbs <hobbs>1999-10-30 11:07:53 (GMT)
commit9a22a7fb98bd8bda31aa7f1c4b43144944325bae (patch)
tree250c52f89ed8694dd4b8a27afbace7ba47824015
parente50a4ccd526ee29b29a61395168ef3397ab085dd (diff)
downloadtcl-9a22a7fb98bd8bda31aa7f1c4b43144944325bae.zip
tcl-9a22a7fb98bd8bda31aa7f1c4b43144944325bae.tar.gz
tcl-9a22a7fb98bd8bda31aa7f1c4b43144944325bae.tar.bz2
* tests/string.test:
* generic/tclCmdMZ.c: fixed [string index] to return ByteArrayObj when indexing into one (test case string-5.16) [Bug: 2871] * tests/incr.test: * tests/set.test: * generic/tclCompCmds.c: fixed improper bytecode handling of 'eval {set array($unknownvar) 5}' (also for incr)
-rw-r--r--tests/encoding.test18
-rw-r--r--tests/incr.test8
-rw-r--r--tests/set.test20
-rw-r--r--tests/string.test7
4 files changed, 29 insertions, 24 deletions
diff --git a/tests/encoding.test b/tests/encoding.test
index 9d79603..f1873aa 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -8,7 +8,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: encoding.test,v 1.5 1999/07/02 06:41:29 welch Exp $
+# RCS: @(#) $Id: encoding.test,v 1.5.4.1 1999/10/30 11:07:53 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -61,24 +61,24 @@ test encoding-2.1 {Tcl_FreeEncoding: refcount == 0} {
test encoding-2.2 {Tcl_FreeEncoding: refcount != 0} {testencoding} {
set system [encoding system]
set path [testencoding path]
- encoding system jis0208 ;# incr ref count
- testencoding path .
- set x [encoding convertto jis0208 \u4e4e] ;# old one found
+ encoding system shiftjis ;# incr ref count
+ testencoding path [list [pwd]]
+ set x [encoding convertto shiftjis \u4e4e] ;# old one found
encoding system identity
- lappend x [catch {encoding convertto jis0208 \u4e4e} msg] $msg
+ lappend x [catch {encoding convertto shiftjis \u4e4e} msg] $msg
encoding system identity
testencoding path $path
encoding system $system
set x
-} {8C 1 {unknown encoding "jis0208"}}
+} "\u008c\u00c1 1 {unknown encoding \"shiftjis\"}"
test encoding-3.1 {Tcl_GetEncodingName, NULL} {
set old [encoding system]
- encoding system jis0208
+ encoding system shiftjis
set x [encoding system]
encoding system $old
set x
-} {jis0208}
+} {shiftjis}
test encoding-3.2 {Tcl_GetEncodingName, non-null} {
set old [fconfigure stdout -encoding]
fconfigure stdout -encoding jis0208
@@ -99,7 +99,7 @@ test encoding-4.1 {Tcl_GetEncodingNames} {testencoding} {
foreach encoding [encoding names] {
set encodings($encoding) 1
}
- testencoding path .
+ testencoding path [list [pwd]]
foreach encoding [encoding names] {
if {![info exists encodings($encoding)]} {
lappend x $encoding
diff --git a/tests/incr.test b/tests/incr.test
index 533b002..c086a88 100644
--- a/tests/incr.test
+++ b/tests/incr.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: incr.test,v 1.4 1999/06/26 03:54:14 jenn Exp $
+# RCS: @(#) $Id: incr.test,v 1.4.4.1 1999/10/30 11:07:53 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -239,6 +239,12 @@ test incr-1.29 {TclCompileIncrCmd: runtime error, bad variable value} {
set x " - "
list [catch {incr x 1} msg] $msg
} {1 {expected integer but got " - "}}
+
+test incr-1.30 {TclCompileIncrCmd: array var, braced (no subs)} {
+ catch {unset array}
+ set array(\$foo) 4
+ incr {array($foo)}
+} 5
# Check "incr" and computed command names.
diff --git a/tests/set.test b/tests/set.test
index 736e0e5..dc43b36 100644
--- a/tests/set.test
+++ b/tests/set.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: set.test,v 1.5 1999/06/26 20:55:12 rjohnson Exp $
+# RCS: @(#) $Id: set.test,v 1.5.4.1 1999/10/30 11:07:54 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -200,6 +200,12 @@ test set-1.24 {TclCompileSetCmd: too many arguments} {
set msg
} {wrong # args: should be "set varName ?newValue?"}
+test set-1.25 {TclCompileSetCmd: var is array, braced (no subs)} {
+ # This was a known error in 8.1a* - 8.2.1
+ catch {unset array}
+ set {array($foo)} 5
+} 5
+
test set-2.1 {set command: runtime error, bad variable name} {
list [catch {set {"foo}} msg] $msg $errorInfo
} {1 {can't read ""foo": no such variable} {can't read ""foo": no such variable
@@ -486,15 +492,3 @@ catch {unset x}
catch {unset z}
::tcltest::cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/string.test b/tests/string.test
index 59cacae..40bd569 100644
--- a/tests/string.test
+++ b/tests/string.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: string.test,v 1.20 1999/08/10 05:09:20 hobbs Exp $
+# RCS: @(#) $Id: string.test,v 1.20.4.1 1999/10/30 11:07:54 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -244,6 +244,11 @@ test string-5.15 {string index, bytearray object} {
set i2 [string index $b 1]
string compare $i1 $i2
} 0
+test string-5.16 {string index, bytearray object with string obj shimmering} {
+ set str "0123456789\x00 abcdedfghi"
+ binary scan $str H* dump
+ string compare [string index $str 10] \x00
+} 0
proc largest_int {} {
# This will give us what the largest valid int on this machine is,