summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testdata/scad/misc/string-unicode.scad10
-rw-r--r--tests/regression/echotest/string-unicode-expected.echo3
2 files changed, 12 insertions, 1 deletions
diff --git a/testdata/scad/misc/string-unicode.scad b/testdata/scad/misc/string-unicode.scad
index d8e3e5c..1386d63 100644
--- a/testdata/scad/misc/string-unicode.scad
+++ b/testdata/scad/misc/string-unicode.scad
@@ -1,3 +1,12 @@
+//Test length reporting
+text_1bytes_len = "1234";
+text_2bytes_len = "ЛЛЛЛ";
+text_4bytes_len = "🂡🂱🃁🃑";
+
+echo( "text_1bytes_len = ", text_1bytes_len, " len = ", len(text_1bytes_len) );
+echo( "text_2bytes_len = ", text_2bytes_len, " len = ", len(text_2bytes_len) );
+echo( "text_4bytes_len = ", text_4bytes_len, " len = ", len(text_4bytes_len) );
+
//Test how well arrays of unicode string are accessed.
texts_array = [
@@ -33,4 +42,3 @@ echo( "Past end of unicode only 4-byte ", text_4bytes[len(text_4bytes)] );
echo( "Past end of both 2-byte ", text_2bytes[ len(text_2bytes) * 2 ] );
echo( "Past end of both 4-byte ", text_4bytes[ len(text_4bytes) * 4 ] );
-
diff --git a/tests/regression/echotest/string-unicode-expected.echo b/tests/regression/echotest/string-unicode-expected.echo
index b4b848f..a1cd3be 100644
--- a/tests/regression/echotest/string-unicode-expected.echo
+++ b/tests/regression/echotest/string-unicode-expected.echo
@@ -1,3 +1,6 @@
+ECHO: "text_1bytes_len = ", "1234", " len = ", 4
+ECHO: "text_2bytes_len = ", "ЛЛЛЛ", " len = ", 4
+ECHO: "text_4bytes_len = ", "🂡🂱🃁🃑", " len = ", 4
ECHO: "[", 0, "] = ", "DEADBEEF", " of len=", 8, ":"
ECHO: " [", 0, "]=", "D"
ECHO: " [", 1, "]=", "E"
contact: Jan Huwald // Impressum