Skip to content

Commit cd7f768

Browse files
committed
tests: allocateCode_zero should fail
1 parent e3fb448 commit cd7f768

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

tests/test-memory.lua

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,10 @@ function test_memory.test_allocateCode()
4848
end
4949

5050
function test_memory.test_allocateCode_zero()
51-
local addr = rps.allocateCode(1000, true)-- sample is hopefully high enough to not have all 0's
51+
local status, errMsg = pcall(function() rps.allocateCode(1000, true) end)-- sample is hopefully high enough to not have all 0's
5252

53-
local nonZero = false
54-
for _, value in ipairs(rps.readBytes(addr, 1000)) do
55-
if value ~= 0 then
56-
nonZero = true
57-
break
58-
end
59-
end
60-
61-
lunatest.assert_false(nonZero, 'all zero values (unexpected)')
53+
lunatest.assert_false(status)
54+
lunatest.assert_equal("Wrong number of arguments passed", errMsg)
6255
end
6356

6457
return test_memory

0 commit comments

Comments
 (0)