From b848650b822bc8ec56b31f0717910a57bbe8d0a0 Mon Sep 17 00:00:00 2001 From: hobbs Date: Sat, 30 Oct 1999 11:07:52 +0000 Subject: * 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) FossilOrigin-Name: fc5c8cd8e2a476cd99d17affe9ccdb80d2871bc0 --- tests/encoding.test | 18 +++++++++--------- tests/incr.test | 8 +++++++- tests/set.test | 20 +++++++------------- tests/string.test | 7 ++++++- 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, -- cgit v0.12