[Tarantool-patches] [PATCH luajit 21/36] test: enable <misc/parse_misc.lua> LuaJIT test

Sergey Kaplun skaplun at tarantool.org
Wed Aug 14 16:56:03 MSK 2024


This patch moves the aforementioned test from the <misc> to the <lang/>
directory, includes it in <index>, names the subtests, and adds checks
for the Lua version.

Part of tarantool/tarantool#9398
---
 test/LuaJIT-tests/lang/index          |  1 +
 test/LuaJIT-tests/lang/parse_misc.lua | 31 +++++++++++++++++++++++++++
 test/LuaJIT-tests/misc/parse_misc.lua | 31 ---------------------------
 3 files changed, 32 insertions(+), 31 deletions(-)
 create mode 100644 test/LuaJIT-tests/lang/parse_misc.lua
 delete mode 100644 test/LuaJIT-tests/misc/parse_misc.lua

diff --git a/test/LuaJIT-tests/lang/index b/test/LuaJIT-tests/lang/index
index 0d1175a8..726c8d16 100644
--- a/test/LuaJIT-tests/lang/index
+++ b/test/LuaJIT-tests/lang/index
@@ -19,6 +19,7 @@ self.lua
 table.lua
 parse_comp.lua
 parse_esc.lua
+parse_misc.lua
 upvalue
 tail_recursion.lua
 vararg_jit.lua
diff --git a/test/LuaJIT-tests/lang/parse_misc.lua b/test/LuaJIT-tests/lang/parse_misc.lua
new file mode 100644
index 00000000..c95758a3
--- /dev/null
+++ b/test/LuaJIT-tests/lang/parse_misc.lua
@@ -0,0 +1,31 @@
+do --- Ambiguous syntax: function call vs. new statement. +lua==5.2
+  assert(assert(loadstring([[
+    local function f() return 99 end
+    return f
+    ()
+  ]]))() == 99)
+end
+
+do --- Ambiguous syntax: function call vs. new statement. +lua<5.2
+  assert(loadstring([[
+    local function f() return 99 end
+    return f
+    ()
+  ]]) == nil)
+end
+
+do --- UTF-8 identifiers.
+  assert(loadstring([[
+  local ä = 1
+  local aäa = 2
+  local äöü·€晶 = 3
+
+  assert(ä == 1)
+  assert(aäa == 2)
+  assert(äöü·€晶 == 3)
+
+  assert(#"ä" == 2)
+  assert(#"aäa" == 4)
+  assert(#"äöü·€晶" == 14)
+  ]]))()
+end
diff --git a/test/LuaJIT-tests/misc/parse_misc.lua b/test/LuaJIT-tests/misc/parse_misc.lua
deleted file mode 100644
index 8031ec17..00000000
--- a/test/LuaJIT-tests/misc/parse_misc.lua
+++ /dev/null
@@ -1,31 +0,0 @@
-
--- Ambiguous syntax: function call vs. new statement.
-if os.getenv("LUA52") then
-  assert(assert(loadstring([[
-local function f() return 99 end
-return f
-()
-]]))() == 99)
-else
-  assert(loadstring([[
-local function f() return 99 end
-return f
-()
-]]) == nil)
-end
-
--- UTF-8 identifiers.
-assert(loadstring([[
-local ä = 1
-local aäa = 2
-local äöü·€晶 = 3
-
-assert(ä == 1)
-assert(aäa == 2)
-assert(äöü·€晶 == 3)
-
-assert(#"ä" == 2)
-assert(#"aäa" == 4)
-assert(#"äöü·€晶" == 14)
-]]))()
-
-- 
2.45.2



More information about the Tarantool-patches mailing list