aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorywang <yw05@forksworld.de>2021-02-10 18:41:12 +0100
committerywang <yw05@forksworld.de>2021-06-09 15:31:21 +0200
commit0dc140c7a7e736cc9e24c8f531b9f80fe941a409 (patch)
tree3edeeda4fcc3084c9f10c5f99281f17a43921c4e
parent62ae75b2ba6b3f5ab9d83ebbb978b96fde83b5c8 (diff)
downloadadvtrains-0dc140c7a7e736cc9e24c8f531b9f80fe941a409.tar.gz
advtrains-0dc140c7a7e736cc9e24c8f531b9f80fe941a409.tar.bz2
advtrains-0dc140c7a7e736cc9e24c8f531b9f80fe941a409.zip
Fix A command after rebasing
-rw-r--r--advtrains/atcjit.lua6
-rw-r--r--advtrains/tests/atcjit_spec.lua10
2 files changed, 12 insertions, 4 deletions
diff --git a/advtrains/atcjit.lua b/advtrains/atcjit.lua
index 6ce908b..708d035 100644
--- a/advtrains/atcjit.lua
+++ b/advtrains/atcjit.lua
@@ -16,10 +16,10 @@ command involves waiting, it should:
argument and the error message as the second argument.
]]
local matchptn = {
- ["A[01FT]"] = function(match)
+ ["A([01FT])"] = function(_, match)
return string.format(
- "advtrains.interlocking.set_ars_disable(train,%s)",
- (match=="0" or match=="F") and "true" or "false"), false
+ "train.ars_disable=%s",
+ (match=="0" or match=="F") and "true" or "false")
end,
["BB"] = function()
return [[do
diff --git a/advtrains/tests/atcjit_spec.lua b/advtrains/tests/atcjit_spec.lua
index 6d8b3f4..638e5c8 100644
--- a/advtrains/tests/atcjit_spec.lua
+++ b/advtrains/tests/atcjit_spec.lua
@@ -167,5 +167,13 @@ 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)
+ thisatc("should report the invalid I statement", t, {}, "Invalid I statement", t)
end)
+
+describe("ATC track that sets ARS modes", function()
+ local t = {atc_command = "A0WA1WAFWAT"}
+ thisatc("should disable ARS on the train with A0", t, {}, nil, {atc_wait_finish=true, ars_disable=true, atc_command="A1WAFWAT"})
+ thisatc("should enable ARS on the train with A1", t, {}, nil, {atc_wait_finish=true, ars_disable=false, atc_command="AFWAT"})
+ thisatc("should disable ARS on the train with AF", t, {}, nil, {atc_wait_finish=true, ars_disable=true, atc_command="AT"})
+ thisatc("should enable ARS on the train with AT", t, {}, nil, {atc_wait_finish=true, ars_disable=false,})
+end) \ No newline at end of file