From fbd42f89f607251adb572461f66c8dd56f7b624c Mon Sep 17 00:00:00 2001 From: ywang Date: Tue, 2 Feb 2021 19:49:02 +0100 Subject: Add command to view generated lua code; add unittests for repeating code --- advtrains/tests/atcjit_spec.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'advtrains/tests/atcjit_spec.lua') diff --git a/advtrains/tests/atcjit_spec.lua b/advtrains/tests/atcjit_spec.lua index 8e2a8b7..6d8b3f4 100644 --- a/advtrains/tests/atcjit_spec.lua +++ b/advtrains/tests/atcjit_spec.lua @@ -154,3 +154,18 @@ describe("ATC track with invalid I condition", function() local t = { atc_command = "I?;" } thisatc("should report an error", t, {}, "Invalid I statement", t) end) + +describe("ATC track reusing existing code", function() + local t = { atc_command = " B12WB8WBBWOLD15ORD15OCD1RS10WSM", tarvelocity = 15 } + thisatc("should do the same thing as in the first test", t, {}, nil, { + atc_brake_target = 12, + atc_command = "B8WBBWOLD15ORD15OCD1RS10WSM", + atc_wait_finish = true, + tarvelocity = 12 + }) +end) + +describe("ATC track reusing malformed code", function() + local t = {atc_command = "I?;"} + thisatc("Should report the invalid I statement", t, {}, "Invalid I statement", t) +end) -- cgit v1.2.3