2015-10-14 13:48:42 +03:00
|
|
|
require_relative "../helper"
|
2014-08-21 22:57:20 +03:00
|
|
|
|
|
|
|
class HelloTest < MiniTest::Test
|
2015-05-16 12:53:10 +03:00
|
|
|
|
2014-08-21 22:57:20 +03:00
|
|
|
def check
|
2015-07-19 11:52:43 +03:00
|
|
|
machine = Virtual.machine.boot
|
2015-08-06 18:55:08 +03:00
|
|
|
Parfait::Space.object_space.get_class_by_name(:Integer).remove_instance_method :plus
|
|
|
|
#TODO remove this hack: write proper aliases
|
2015-10-09 17:51:14 +03:00
|
|
|
statements = machine.parse_and_compile @string_input
|
2015-06-22 22:48:42 +03:00
|
|
|
output_at = "Register::CallImplementation"
|
2015-06-21 00:21:42 +03:00
|
|
|
#{}"Register::CallImplementation"
|
2015-10-18 19:27:02 +03:00
|
|
|
machine.collect
|
2015-06-21 00:21:42 +03:00
|
|
|
machine.run_before output_at
|
2015-06-30 10:22:54 +03:00
|
|
|
#puts Sof.write(machine.space)
|
2015-06-21 00:21:42 +03:00
|
|
|
machine.run_after output_at
|
2015-05-16 12:53:10 +03:00
|
|
|
writer = Elf::ObjectWriter.new(machine)
|
2014-08-30 14:17:00 +03:00
|
|
|
writer.save "hello.o"
|
2014-08-21 22:57:20 +03:00
|
|
|
end
|
|
|
|
|
2015-07-21 19:41:30 +03:00
|
|
|
def test_string_put
|
2014-08-22 10:21:12 +03:00
|
|
|
@string_input = <<HERE
|
2015-10-06 00:27:13 +03:00
|
|
|
class Object
|
|
|
|
int main()
|
|
|
|
"Hello again\n".putstring()
|
|
|
|
end
|
|
|
|
end
|
2014-08-21 22:57:20 +03:00
|
|
|
HERE
|
|
|
|
check
|
|
|
|
end
|
2015-05-16 12:53:10 +03:00
|
|
|
end
|