Skip to content

Commit e616e6f

Browse files
committed
tests/lapi: update assertions in os tests
The patch updates assertions for values returned by `os.date()` and `os.time()`. Follows up #141
1 parent 35b6dc8 commit e616e6f

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

tests/lapi/os_date_test.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ local function TestOneInput(buf)
3232
local err_handler = test_lib.err_handler(ignored_msgs)
3333
local ok, res = xpcall(os.date, err_handler, format, time)
3434
if not ok then return end
35-
assert(type(res) == "string" or
36-
type(res) == "table" or
37-
-- Undocumented.
38-
type(res) == "number" or
39-
res == nil)
35+
local type_check = type(res) == "string" or type(res) == "table"
36+
local undocumented_type_check = type(res) == "number" or res == nil
37+
assert(type_check or undocumented_type_check)
4038
end
4139

4240
local args = {

tests/lapi/os_time_test.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ local function TestOneInput(buf)
3232
local err_handler = test_lib.err_handler(ignored_msgs)
3333
local ok, res = xpcall(os.time, err_handler, time)
3434
if not ok then return end
35-
io.stderr:write(type(res) .. "\n")
36-
assert(type(res) == "number" or
37-
type(res) == "table" or
38-
-- Undocumented.
39-
res == nil)
35+
local type_check = type(res) == "number" or type(res) == "table"
36+
local undocumented_type_check = res == nil
37+
assert(type_check or undocumented_type_check)
4038
end
4139

4240
local args = {

0 commit comments

Comments
 (0)