diff options
author | dgp <dgp@users.sourceforge.net> | 2005-05-18 15:43:21 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2005-05-18 15:43:21 (GMT) |
commit | f063018fe11304895ff9ac81830ac933c831ca5f (patch) | |
tree | 678c51cb9c004400d22c5f60e2a86515ab70ec8a /tests/obj.test | |
parent | 51a0c200366a96df5068e05042f8a70c7243423f (diff) | |
download | tcl-f063018fe11304895ff9ac81830ac933c831ca5f.zip tcl-f063018fe11304895ff9ac81830ac933c831ca5f.tar.gz tcl-f063018fe11304895ff9ac81830ac933c831ca5f.tar.bz2 |
* generic/tclInt.h: Revision to the "boolean" Tcl_ObjType, so
* generic/tclObj.c: that only string values like "yes" and "false"
* tests/obj.test: are kept as the "boolean" Tcl_ObjType. The
string values "0" and "1" are kept as "int" Tcl_ObjType, which also
produce quick calls to Tcl_GetBooleanFromObj(). Since this internal
change means a Tcl_ConvertToType to a "boolean" Tcl_ObjType might
not produce a Tcl_Obj of type "boolean", the registration of the
"boolean" type is also removed.
***POTENTIAL INCOMPATIBILITY***
For callers of Tcl_GetObjType on the type name "boolean".
Diffstat (limited to 'tests/obj.test')
-rw-r--r-- | tests/obj.test | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/tests/obj.test b/tests/obj.test index dfbad05..fb7e1d1 100644 --- a/tests/obj.test +++ b/tests/obj.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: obj.test,v 1.15 2005/05/17 21:29:18 dgp Exp $ +# RCS: @(#) $Id: obj.test,v 1.16 2005/05/18 15:43:38 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -48,7 +48,6 @@ test obj-1.1 {Tcl_AppendAllObjTypes, and InitTypeTable, Tcl_RegisterObjType} tes foreach {t} { {array search} bignum - boolean bytearray bytecode cmdName @@ -177,7 +176,7 @@ test obj-9.1 {Tcl_NewBooleanObj} testobj { lappend result [testbooleanobj set 1 0] lappend result [testobj type 1] lappend result [testobj refcount 1] -} {{} 0 boolean 2} +} {{} 0 int 2} test obj-10.1 {Tcl_SetBooleanObj, existing "empty string" object} testobj { set result "" @@ -186,7 +185,7 @@ test obj-10.1 {Tcl_SetBooleanObj, existing "empty string" object} testobj { lappend result [testbooleanobj set 1 0] ;# makes existing obj boolean lappend result [testobj type 1] lappend result [testobj refcount 1] -} {{} {} 0 boolean 2} +} {{} {} 0 int 2} test obj-10.2 {Tcl_SetBooleanObj, existing non-"empty string" object} testobj { set result "" lappend result [testobj freeallvars] @@ -194,7 +193,7 @@ test obj-10.2 {Tcl_SetBooleanObj, existing non-"empty string" object} testobj { lappend result [testbooleanobj set 1 1] ;# makes existing obj boolean lappend result [testobj type 1] lappend result [testobj refcount 1] -} {{} 98765 1 boolean 2} +} {{} 98765 1 int 2} test obj-11.1 {Tcl_GetBooleanFromObj, existing boolean object} testobj { set result "" @@ -206,7 +205,7 @@ test obj-11.2 {Tcl_GetBooleanFromObj, convert to boolean} testobj { lappend result [testintobj set 1 47] lappend result [testbooleanobj not 1] ;# must convert to bool lappend result [testobj type 1] -} {47 0 boolean} +} {47 0 int} test obj-11.3 {Tcl_GetBooleanFromObj, error converting to boolean} testobj { set result "" lappend result [teststringobj set 1 abc] @@ -224,13 +223,13 @@ test obj-11.5 {Tcl_GetBooleanFromObj, convert hex to boolean} testobj { lappend result [teststringobj set 1 0xac] lappend result [testbooleanobj not 1] lappend result [testobj type 1] -} {0xac 0 boolean} +} {0xac 0 int} test obj-11.6 {Tcl_GetBooleanFromObj, convert float to boolean} testobj { set result "" lappend result [teststringobj set 1 5.42] lappend result [testbooleanobj not 1] lappend result [testobj type 1] -} {5.42 0 boolean} +} {5.42 0 int} test obj-12.1 {DupBooleanInternalRep} testobj { set result "" @@ -244,13 +243,13 @@ test obj-13.1 {SetBooleanFromAny, int to boolean special case} testobj { lappend result [testintobj set 1 1234] lappend result [testbooleanobj not 1] ;# converts with SetBooleanFromAny lappend result [testobj type 1] -} {1234 0 boolean} +} {1234 0 int} test obj-13.2 {SetBooleanFromAny, double to boolean special case} testobj { set result "" lappend result [testdoubleobj set 1 3.14159] lappend result [testbooleanobj not 1] ;# converts with SetBooleanFromAny lappend result [testobj type 1] -} {3.14159 0 boolean} +} {3.14159 0 int} test obj-13.3 {SetBooleanFromAny, special case strings representing booleans} testobj { set result "" foreach s {yes no true false on off} { @@ -258,14 +257,14 @@ test obj-13.3 {SetBooleanFromAny, special case strings representing booleans} te lappend result [testbooleanobj not 1] } lappend result [testobj type 1] -} {0 1 0 1 0 1 boolean} +} {0 1 0 1 0 1 int} test obj-13.4 {SetBooleanFromAny, recompute string rep then parse it} testobj { set result "" lappend result [testintobj set 1 456] lappend result [testintobj div10 1] lappend result [testbooleanobj not 1] ;# converts with SetBooleanFromAny lappend result [testobj type 1] -} {456 45 0 boolean} +} {456 45 0 int} test obj-13.5 {SetBooleanFromAny, error parsing string} testobj { set result "" lappend result [teststringobj set 1 abc] @@ -573,7 +572,7 @@ test obj-30.1 {Ref counting and object deletion, simple types} testobj { lappend result [testobj type 2] lappend result [testobj refcount 1] lappend result [testobj refcount 2] -} {{} 1024 1024 int 4 4 0 boolean 3 2} +} {{} 1024 1024 int 4 4 0 int 3 2} test obj-31.1 {regenerate string rep of "end"} testobj { |