diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-20 20:44:24 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-20 20:44:24 (GMT) |
commit | 059d5cc1803ee62dea1b7fd7e42e75453ce27264 (patch) | |
tree | 4249a84f3b3f79e067cc4153b70b562e05f6f11e /tests/binary.test | |
parent | 4551b215909f0c208728bd8fa5f39e07b6370dde (diff) | |
download | tcl-059d5cc1803ee62dea1b7fd7e42e75453ce27264.zip tcl-059d5cc1803ee62dea1b7fd7e42e75453ce27264.tar.gz tcl-059d5cc1803ee62dea1b7fd7e42e75453ce27264.tar.bz2 |
Add test-cases handling TclGetBytesFromObj() ( actually Tcl_UtfToUniChar too)
Diffstat (limited to 'tests/binary.test')
-rw-r--r-- | tests/binary.test | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/binary.test b/tests/binary.test index a777b2a..b06afe0 100644 --- a/tests/binary.test +++ b/tests/binary.test @@ -16,6 +16,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} { } testConstraint bigEndian [expr {$tcl_platform(byteOrder) eq "bigEndian"}] testConstraint littleEndian [expr {$tcl_platform(byteOrder) eq "littleEndian"}] +testConstraint testbytestring [llength [info commands testbytestring]] # Big test for correct ordering of data in [expr] proc testIEEE {} { @@ -2941,7 +2942,19 @@ test binary-79.2 {Tcl_SetByteArrayLength} testsetbytearraylength { testsetbytearraylength [string cat \u0141 B C] 1 } A - +test binary-80.1 {TclGetBytesFromObj} -constraints testbytestring -returnCodes 1 -body { + testbytestring "\u4E4E" +} -result "expected byte sequence but character 0 was '\u4E4E' (U+004E4E)" +test binary-80.2 {TclGetBytesFromObj} -constraints testbytestring -returnCodes 1 -body { + testbytestring [testbytestring "\x00\xA0\xA0\xA0\xE4\xB9\x8E"] +} -result "expected byte sequence but character 4 was '\u4E4E' (U+004E4E)" +test binary-80.3 {TclGetBytesFromObj} -constraints testbytestring -returnCodes 1 -body { + testbytestring [testbytestring "\xC0\x80\xA0\xA0\xA0\xE4\xB9\x8E"] +} -result "expected byte sequence but character 4 was '\u4E4E' (U+004E4E)" +test binary-80.4 {TclGetBytesFromObj} -constraints testbytestring -returnCodes 1 -body { + testbytestring [testbytestring "\xC0\x80\xA0\xA0\xA0\xF0\x9F\x98\x81"] +} -result "expected byte sequence but character 4 was '\U01F601' (U+01F601)" + # ---------------------------------------------------------------------- # cleanup |