hacking method not found
was using exit, since raise is not implemented. This was ambiguous as all programs exit. Using :died as special kernel code and bending it, and reporting it in interpreter.
This commit is contained in:
@ -42,7 +42,7 @@ module Mains
|
||||
run_all
|
||||
assert_equal ::Integer , get_return.class , " "
|
||||
#assert_equal 4 , get_return , " "
|
||||
assert_equal "hi" , @interpreter.stdout
|
||||
assert_equal "Space" , @interpreter.stdout
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -27,7 +27,7 @@ module Risc
|
||||
def test_sys
|
||||
produced = produce_body
|
||||
assert_equal Syscall , produced.next(29).class
|
||||
assert_equal :exit , produced.next(29).name
|
||||
assert_equal :died , produced.next(29).name
|
||||
end
|
||||
def test_load_address
|
||||
produced = produce_body
|
||||
|
@ -91,5 +91,16 @@ module Risc
|
||||
def test_tick_15 #more than a binary code worth
|
||||
31.times {@interpreter.tick}
|
||||
end
|
||||
class TestInterpreterDies < MiniTest::Test
|
||||
include Ticker
|
||||
def setup
|
||||
@string_input = as_main("random.call")
|
||||
super
|
||||
end
|
||||
def test_dies
|
||||
# no method does syscall :dies that raises
|
||||
assert_raises {44.times {@interpreter.tick}}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user