mirror of
https://github.com/lune-org/lune.git
synced 2025-05-04 10:43:57 +01:00
fix(tests): put locale tests behind flag lock
This commit is contained in:
parent
d3dd11313f
commit
fcb2057115
1 changed files with 22 additions and 7 deletions
|
@ -8,12 +8,6 @@ assert(
|
|||
"invalid ISO 8601 formatting for DateTime.formatTime() (UTC)"
|
||||
)
|
||||
|
||||
assert(
|
||||
DateTime.fromUnixTimestamp(1693068988):formatTime("utc", "%A, %d %B %Y", "fr")
|
||||
== "samedi, 26 août 2023",
|
||||
"expected format specifier '%A, %d %B %Y' to return 'samedi, 26 août 2023' for locale 'fr' (UTC)"
|
||||
)
|
||||
|
||||
local expectedTimeString = os.date("%Y-%m-%dT%H:%M:%SZ", 1694078954)
|
||||
|
||||
assert(
|
||||
|
@ -34,6 +28,21 @@ assert(
|
|||
"invalid ISO 8601 formatting for DateTime.formatTime() (local)"
|
||||
)
|
||||
|
||||
-- To run tests related to locales, one must explicitly
|
||||
-- provide the `--test-locales` flag
|
||||
local toTestLocales = false
|
||||
|
||||
for _, arg in process.args do
|
||||
if arg == "--test-locales" then
|
||||
toTestLocales = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not toTestLocales then
|
||||
return true
|
||||
end
|
||||
|
||||
local expectedLocalizedString
|
||||
|
||||
local dateCmd = process.spawn("bash", { "-c", "date +\"%A, %d %B %Y\" --date='@1693068988'" }, {
|
||||
|
@ -53,3 +62,9 @@ assert(
|
|||
== expectedLocalizedString,
|
||||
`expected format specifier '%A, %d %B %Y' to return '{expectedLocalizedString}' for locale 'fr' (local)`
|
||||
)
|
||||
|
||||
assert(
|
||||
DateTime.fromUnixTimestamp(1693068988):formatTime("utc", "%A, %d %B %Y", "fr")
|
||||
== "samedi, 26 août 2023",
|
||||
"expected format specifier '%A, %d %B %Y' to return 'samedi, 26 août 2023' for locale 'fr' (UTC)"
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue