Skip to content

Commit 6c41199

Browse files
committed
test: removed asserts, to align with real turtle
1 parent 8c26b24 commit 6c41199

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

TestSuite-lib

turtleMock.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ local function forward(self, act)
168168

169169
---@type Vector
170170
local newPosition = self.position + self.facing
171-
172171
if self.emulator:getBlock(newPosition) ~= nil then
173172
return false, "Movement obstructed by " .. self.emulator:getBlock(newPosition).item.name, newPosition
174173
end
@@ -364,7 +363,9 @@ end
364363
---@return boolean
365364
---@return string | nil
366365
local function dig(turtle, block)
367-
assert(block, "Block is nil in dig")
366+
if block == nil then
367+
return false, "Nothing to dig here"
368+
end
368369
if not canDoAction(turtle, block, "dig") then
369370
return false, "Cannot beak block with this tool"
370371
end
@@ -422,7 +423,7 @@ end
422423
local function place(turtle, position)
423424
local item = turtle.inventory[turtle.inventory.selectedSlot]
424425
if item == nil then
425-
return false, "No item to place"
426+
return false, "No items to place"
426427
end
427428
if item.placeAction ~= nil then
428429
return item.placeAction(turtle, item, position)
@@ -608,21 +609,18 @@ end
608609
function turtleMock:dig()
609610
local blockPos = self.position + self.facing
610611
local block = self.emulator:getBlock(blockPos)
611-
assert(block, "Block not found at position: " .. tostring(blockPos))
612612
return dig(self, block)
613613
end
614614

615615
function turtleMock:digUp()
616616
local blockPos = (self.position + vector.new(0, 1, 0))
617617
local block = self.emulator:getBlock(blockPos)
618-
assert(block, "Block not found at position: " .. tostring(blockPos))
619618
return dig(self, block)
620619
end
621620

622621
function turtleMock:digDown()
623622
local blockPos = (self.position + vector.new(0, -1, 0))
624623
local block = self.emulator:getBlock(blockPos)
625-
assert(block, "Block not found at position: " .. tostring(blockPos))
626624
return dig(self, block)
627625
end
628626

0 commit comments

Comments
 (0)