[Tarantool-patches] [PATCH luajit v3 17/29] test: disable locale-dependent PUC-Rio tests

Sergey Kaplun skaplun at tarantool.org
Tue Apr 13 16:27:17 MSK 2021


LuaJIT doesn't compare strings by `strcoll()`, like Lua 5.1 does.
So locale-depended tests in <strings.lua> are disabled.

Also, LuaJIT doesn't use `strtod()` dependent on the locale for parsing,
unlike Lua does. See <src/lj_strscan.c> for more info. See also
http://luajit.org/extensions.html#tonumber.
Locale-depended tests in <literals.lua> are disabled.

Part of tarantool/tarantool#5845
Part of tarantool/tarantool#4473
---
 test/PUC-Rio-Lua-5.1-tests/literals.lua | 5 +++++
 test/PUC-Rio-Lua-5.1-tests/strings.lua  | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/test/PUC-Rio-Lua-5.1-tests/literals.lua b/test/PUC-Rio-Lua-5.1-tests/literals.lua
index 01d84d5a..4fc3e88d 100644
--- a/test/PUC-Rio-Lua-5.1-tests/literals.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/literals.lua
@@ -158,6 +158,10 @@ end
 
 
 -- testing decimal point locale
+-- LuaJIT: LuaJIT doesn't use `strtod()` dependent on the locale,
+-- unlike Lua does. See <src/lj_strscan.c> for more info.
+-- Tests are disabled for LuaJIT.
+--[[
 if os.setlocale("pt_BR") or os.setlocale("ptb") then
   assert(tonumber("3,4") == 3.4 and tonumber"3.4" == nil)
   assert(assert(loadstring("return 3.4"))() == 3.4)
@@ -171,6 +175,7 @@ else
   (Message or print)(
    '\a\n >>> pt_BR locale not available: skipping decimal point tests <<<\n\a')
 end
+--]]
 
 
 print('OK')
diff --git a/test/PUC-Rio-Lua-5.1-tests/strings.lua b/test/PUC-Rio-Lua-5.1-tests/strings.lua
index 0eee4c6e..67e42cb6 100644
--- a/test/PUC-Rio-Lua-5.1-tests/strings.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/strings.lua
@@ -188,6 +188,10 @@ local function trylocale (w)
   return false
 end
 
+-- LuaJIT: LuaJIT doesn't compare strings by `strcoll()`,
+-- like Lua 5.1 does.
+-- Tests are disabled for LuaJIT.
+--[[
 if not trylocale("collate")  then
   print("locale not supported")
 else
@@ -202,6 +206,7 @@ else
   assert(string.gsub("áÁéÉ", "%u", "x") == "áxéx")
   assert(string.upper"áÁé{xuxu}ção" == "ÁÁÉ{XUXU}ÇÃO")
 end
+--]]
 
 os.setlocale("C")
 assert(os.setlocale() == 'C')
-- 
2.31.0



More information about the Tarantool-patches mailing list