[Tarantool-patches] [PATCH v2 luajit 17/30] test: disable locale-depended tests for Lua suite

Sergey Ostanevich sergos at tarantool.org
Fri Mar 26 17:58:29 MSK 2021


LGTM.
Sergos


> On 26 Mar 2021, at 10:43, Sergey Kaplun <skaplun at tarantool.org> wrote:
> 
> 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()` depended on the locale for parsing,
> unlike Lua does. See <src/lj_strscan.c> for more info.
> Locale-depended tests in <literals.lua> are disabled.
> 
> Part of tarantool/tarantool#5845
> Part of tarantool/tarantool#4473
> ---
> test/PUC-Lua-5.1-tests/literals.lua | 5 +++++
> test/PUC-Lua-5.1-tests/strings.lua  | 5 +++++
> 2 files changed, 10 insertions(+)
> 
> diff --git a/test/PUC-Lua-5.1-tests/literals.lua b/test/PUC-Lua-5.1-tests/literals.lua
> index 01d84d5..1b4f664 100644
> --- a/test/PUC-Lua-5.1-tests/literals.lua
> +++ b/test/PUC-Lua-5.1-tests/literals.lua
> @@ -158,6 +158,10 @@ end
> 
> 
> -- testing decimal point locale
> +-- LuaJIT: LuaJIT doesn't use `strtod()` depended 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-Lua-5.1-tests/strings.lua b/test/PUC-Lua-5.1-tests/strings.lua
> index 7c1dfb8..6ae3f51 100644
> --- a/test/PUC-Lua-5.1-tests/strings.lua
> +++ b/test/PUC-Lua-5.1-tests/strings.lua
> @@ -162,6 +162,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
> @@ -176,6 +180,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