diff --git a/testdata/scad/misc/string-unicode.scad b/testdata/scad/misc/string-unicode.scad index d8e3e5c9..1386d63d 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 b4b848fd..a1cd3bec 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"