Skip to content

Commit 9c77028

Browse files
committed
tests/lapi: cache locales
1 parent 05261c7 commit 9c77028

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/lapi/lib.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,14 @@ local function approx_equal(a, b, epsilon)
8686
return abs(a - b) <= ((abs(a) < abs(b) and abs(b) or abs(a)) * epsilon)
8787
end
8888

89+
local locales
90+
8991
local function random_locale(fdp)
90-
local locales = {}
92+
if locales then
93+
return fdp:oneof(locales)
94+
end
9195
local locale_it = io.popen("locale -a"):read("*a"):gmatch("([^\n]*)\n?")
96+
locales = {}
9297
for locale in locale_it do
9398
table.insert(locales, locale)
9499
end

0 commit comments

Comments
 (0)