Branch: Tag:

2001-04-18

2001-04-18 17:12:58 by Marcus Comstedt <marcus@mc.pp.se>

Added surrogate and byteorder mark handling to unicode_to_string().

Rev: src/builtin_functions.c:1.363
Rev: src/testsuite.in:1.404

1: - test_true([["$Id: testsuite.in,v 1.403 2001/04/16 01:52:17 mast Exp $"]]); + test_true([["$Id: testsuite.in,v 1.404 2001/04/18 17:12:58 marcus Exp $"]]);      cond([[all_constants()->_verify_internals]],   [[
6518:   test_eq(string_to_unicode("blä"), "\0b\0l\0ä")   test_eq(string_to_unicode("\77077"), "\176\77")   test_eq(string_to_unicode("\777077"), "\330\277\336\77") - // Enable when unicode_to_string() understands surrogates. - dnl test_eq(unicode_to_string("\330\277\336\77"), "\777077") - // Disable when unicode_to_string() understands surrogates. - test_eq(unicode_to_string("\330\277\336\77"), "\154277\157077") + test_eq(string_to_unicode("\777077foo\77077\777077blä\777077"), "\330\277\336\77\0f\0o\0o\176\77\330\277\336\77\0b\0l\0ä\330\277\336\77") + test_eq(unicode_to_string("\330\277\336\77\0f\0o\0o\176\77\330\277\336\77\0b\0l\0ä\330\277\336\77"), "\777077foo\77077\777077blä\777077") + test_eq(unicode_to_string("\330\277\336\77"), "\777077")   test_eq(unicode_to_string("\176\77"), "\77077")   test_eq(unicode_to_string("\0b\0l\0ä"), "blä")   test_eq(unicode_to_string("\0f\0o\0o"), "foo") -  + test_eq(unicode_to_string("\xfe\xff\330\277\336\77\0f\0o\0o\176\77\330\277\336\77\0b\0l\0ä\330\277\336\77"), "\777077foo\77077\777077blä\777077") + test_eq(unicode_to_string("\xfe\xff\330\277\336\77"), "\777077") + test_eq(unicode_to_string("\xfe\xff\176\77"), "\77077") + test_eq(unicode_to_string("\xfe\xff\0b\0l\0ä"), "blä") + test_eq(unicode_to_string("\xfe\xff\0f\0o\0o"), "foo") + test_eq(unicode_to_string("\xff\xfe\277\330\77\336f\0o\0o\0\77\176\277\330\77\336b\0l\0ä\0\277\330\77\336"), "\777077foo\77077\777077blä\777077") + test_eq(unicode_to_string("\xff\xfe\277\330\77\336"), "\777077") + test_eq(unicode_to_string("\xff\xfe\77\176"), "\77077") + test_eq(unicode_to_string("\xff\xfe""b\0l\0ä\0"), "blä") + test_eq(unicode_to_string("\xff\xfe""f\0o\0o\0"), "foo")      test_eval_error(return string_to_unicode("\7077077"))