From 4f23b4f534ec7658996b353b6e6eccb716fe09b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Thu, 15 Oct 1998 15:53:49 +0200 Subject: [PATCH] Added some tests for string_to_unicode() and unicode_to_string(). Rev: src/testsuite.in:1.128 --- src/testsuite.in | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/testsuite.in b/src/testsuite.in index 56ac1749a4..350905a7f9 100644 --- a/src/testsuite.in +++ b/src/testsuite.in @@ -1,4 +1,4 @@ -stest_true([["$Id: testsuite.in,v 1.127 1998/10/15 04:31:21 grubba Exp $"]]) +stest_true([["$Id: testsuite.in,v 1.128 1998/10/15 13:53:49 grubba Exp $"]]) cond([[all_constants()->_verify_internals]], [[ test_do(_verify_internals()) @@ -2398,7 +2398,22 @@ test_do(sleep(0.5)) test_any([[int x=time(); sleep(2); return x!=time()]],1) test_any([[int x=time(); sleep(2); return x!=time()]],1) -// - string_to_unicode, string_to_utf8, unicode_to_string, utf8_to_string +// - string_to_unicode, unicode_to_string +test_eq(string_to_unicode("foo"), "\0f\0o\0o") +test_eq(string_to_unicode("bl�"), "\0b\0l\o�") +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. +// 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(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_eval_error(string_to_unicode("\7077077")) + +// - string_to_utf8, utf8_to_string test_eq(string_to_utf8("foo"), "foo") test_eq(string_to_utf8("bl�"), "bl\303\244") test_eq(string_to_utf8("\77077"), "\347\270\277") -- GitLab