From b9c3674755e9a4304b87406a73973a4fdb7aa2e0 Mon Sep 17 00:00:00 2001 From: Rahix Date: Tue, 16 Apr 2019 22:30:18 +0200 Subject: [PATCH] Actually make bc timeout Signed-off-by: Rahix --- bc.lua | 2 +- tests/timeout.lua | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bc.lua b/bc.lua index ef5c4f8fea7d..306cb119cd00 100644 --- a/bc.lua +++ b/bc.lua @@ -171,7 +171,7 @@ function BaseControl:finalize(waits, timeout) if timeout ~= nil then timeout_remaining = timeout - (computer.uptime() - tstart) if timeout_remaining <= 0 then - break + error("timeout") end end -- Wait until the next register arrives diff --git a/tests/timeout.lua b/tests/timeout.lua index 6fcd245466f1..d5167391ee3b 100644 --- a/tests/timeout.lua +++ b/tests/timeout.lua @@ -50,5 +50,7 @@ end function test_timeout_finalize() local bc1 = BaseControl:new() local addr1 = network.get_scene() - bc1:finalize({"to_final1"}, 0.1) + assert_error_match("timeout", function() + bc1:finalize({"to_final1"}, 0.1) + end) end