2018-08-08 12:03:17 +03:00
|
|
|
require_relative 'helper'
|
|
|
|
|
2019-08-24 17:00:14 +03:00
|
|
|
# The "New" in this TestNew means that this is the place to develop a new test for the
|
|
|
|
# mains dir.
|
|
|
|
# If you just pop a file in the source directory, all tests will run.
|
2019-02-27 09:48:21 +02:00
|
|
|
# This is fine if all is fine. But if all is fine, you are not developing, just playing.
|
2019-08-24 17:00:14 +03:00
|
|
|
# So when you really need to itereate editing this gives guard auto-run and just of that
|
2019-02-27 09:48:21 +02:00
|
|
|
# one test that you work on.
|
|
|
|
|
|
|
|
# After getting the test to run, copy paste the whole code into a file in source and revert
|
|
|
|
# changes on this file.
|
|
|
|
|
2018-08-08 12:03:17 +03:00
|
|
|
module Mains
|
|
|
|
class TestNew < MiniTest::Test
|
|
|
|
include Risc::Ticker
|
|
|
|
|
2019-02-27 09:48:21 +02:00
|
|
|
def whole_input
|
|
|
|
<<-eos
|
2019-09-24 17:25:19 +03:00
|
|
|
class Class < Behaviour
|
2019-09-08 15:31:03 +03:00
|
|
|
def get_name
|
|
|
|
@name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class Type
|
|
|
|
def get_name
|
|
|
|
@object_class.get_name
|
2019-02-27 09:48:21 +02:00
|
|
|
end
|
2019-09-08 15:31:03 +03:00
|
|
|
end
|
|
|
|
class Space
|
2019-02-27 09:48:21 +02:00
|
|
|
def main(arg)
|
2019-09-08 15:31:03 +03:00
|
|
|
@type.get_name.putstring
|
2019-02-27 09:48:21 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
eos
|
|
|
|
end
|
|
|
|
|
2018-08-08 12:03:17 +03:00
|
|
|
def setup
|
2019-09-13 14:07:12 +03:00
|
|
|
@preload = "Word.put"
|
2019-02-27 09:48:21 +02:00
|
|
|
@string_input = whole_input
|
2018-08-08 12:03:17 +03:00
|
|
|
super
|
|
|
|
end
|
2019-02-27 09:48:21 +02:00
|
|
|
def test_chain
|
2018-08-08 12:03:17 +03:00
|
|
|
run_all
|
2019-02-07 18:24:35 +02:00
|
|
|
assert_equal ::Integer , get_return.class , " "
|
2019-09-08 15:31:03 +03:00
|
|
|
#assert_equal 4 , get_return , " "
|
2019-09-09 11:47:37 +03:00
|
|
|
assert_equal "Space" , @interpreter.stdout
|
2018-08-08 12:03:17 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|