From 0145bb06913870bab75af32ab08e5709c59f33b2 Mon Sep 17 00:00:00 2001 From: Kaoru HAYAMA Date: Sun, 19 Aug 2018 17:49:16 +0900 Subject: [PATCH] Add t/utf8lua.lua (test for utf8.len) (#319) --- t/utf8len.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 t/utf8len.lua diff --git a/t/utf8len.lua b/t/utf8len.lua new file mode 100644 index 00000000..cbc0063a --- /dev/null +++ b/t/utf8len.lua @@ -0,0 +1,12 @@ +local text="あいうえおかきくけこさしすせそ" + +for i=1,string.len(text) do + for j=i,string.len(text) do + local len,err =utf8.len(text,i,j) + if len then + print(string.format("[%d:%d]=%d",i,j,len)) + else + print(string.format("[%d:%d]=ERROR %s",i,j,err)) + end + end +end