Activate serialize_lib unit tests

This commit is contained in:
Gabriel Pérez-Cerezo 2021-11-10 11:39:54 +01:00
parent 3561a7bfa2
commit 890369090e
2 changed files with 6 additions and 4 deletions

View File

@ -33,6 +33,8 @@ tasks:
busted busted
cd ../advtrains_interlocking cd ../advtrains_interlocking
busted busted
cd ../serialize_lib
busted
- activate_test_env: | - activate_test_env: |
cd advtrains cd advtrains
git merge --no-commit origin/luaatcdebug git merge --no-commit origin/luaatcdebug

View File

@ -10,7 +10,7 @@ ser = require("serialize")
local mock_file = {} local mock_file = {}
_G.mock_file = mock_file _G.mock_file = mock_file
function mock_file:read(arg) function mock_file:read(arg)
if arg == "*l" then if arg == "*l" or arg== "*line" then
local l = self.lines[self.pointer or 1] local l = self.lines[self.pointer or 1]
self.pointer = (self.pointer or 1) + 1 self.pointer = (self.pointer or 1) + 1
return l return l
@ -49,7 +49,7 @@ local testtable = {
["es&&ca&\npe3"] = "baz&&bam&\nbim", ["es&&ca&\npe3"] = "baz&&bam&\nbim",
["es&:cape4"] = "foo\n:bar" ["es&:cape4"] = "foo\n:bar"
} }
local testser = [[LUA_SER v=1 local testser = [[LUA_SER v=2
B1:T B1:T
Sa:Sb Sa:Sb
Sc:B0 Sc:B0
@ -81,13 +81,13 @@ local function check_read(text)
return ser.read_from_fd(f) return ser.read_from_fd(f)
end end
local noskip = [[LUA_SER v=1 local noskip = [[LUA_SER v=2
N1:T N1:T
E E
E E
END_SER END_SER
]] ]]
local skip = [[LUA_SER v=1 local skip = [[LUA_SER v=2
E E
END_SER END_SER
]] ]]