2014-06-26 17:52:15 +03:00
|
|
|
require_relative "virtual_helper"
|
|
|
|
|
|
|
|
class TestBasic < MiniTest::Test
|
|
|
|
include VirtualHelper
|
2014-07-01 15:57:13 +03:00
|
|
|
|
2014-06-26 17:52:15 +03:00
|
|
|
def test_number
|
|
|
|
@string_input = '42 '
|
2014-06-26 18:39:02 +03:00
|
|
|
@output = [Virtual::IntegerConstant.new(42)]
|
2014-06-26 17:52:15 +03:00
|
|
|
check
|
|
|
|
end
|
|
|
|
|
2014-07-01 15:57:13 +03:00
|
|
|
def test_true
|
|
|
|
@string_input = 'true '
|
|
|
|
@output = [Virtual::TrueValue.new()]
|
|
|
|
check
|
|
|
|
end
|
|
|
|
def test_false
|
|
|
|
@string_input = 'false '
|
|
|
|
@output = [Virtual::FalseValue.new()]
|
|
|
|
check
|
|
|
|
end
|
|
|
|
def test_nil
|
|
|
|
@string_input = 'nil '
|
|
|
|
@output = [Virtual::NilValue.new()]
|
|
|
|
check
|
|
|
|
end
|
|
|
|
|
2014-06-26 17:52:15 +03:00
|
|
|
def test_name
|
|
|
|
@string_input = 'foo '
|
2014-07-15 10:35:29 +03:00
|
|
|
@output = [Virtual::Return.new(Virtual::Mystery)]
|
2014-06-29 19:05:35 +03:00
|
|
|
check
|
2014-06-26 17:52:15 +03:00
|
|
|
end
|
|
|
|
|
2014-07-14 14:29:33 +03:00
|
|
|
def test_self
|
|
|
|
@string_input = 'self '
|
2014-07-15 10:35:29 +03:00
|
|
|
@output = [Virtual::Self.new(Virtual::Mystery.new())]
|
2014-07-14 14:29:33 +03:00
|
|
|
check
|
|
|
|
end
|
|
|
|
|
2014-06-26 17:52:15 +03:00
|
|
|
def test_instance_variable
|
|
|
|
@string_input = '@foo_bar '
|
2014-07-15 10:35:29 +03:00
|
|
|
@output = [Virtual::Return.new( Virtual::Mystery.new())]
|
2014-06-29 19:05:35 +03:00
|
|
|
check
|
2014-06-26 17:52:15 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_module_name
|
|
|
|
@string_input = 'FooBar '
|
2014-07-14 14:29:33 +03:00
|
|
|
@output = [Boot::BootClass.new(:FooBar,:Object)]
|
2014-06-29 19:05:35 +03:00
|
|
|
check
|
2014-06-26 17:52:15 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_string
|
|
|
|
@string_input = "\"hello\""
|
2014-07-12 21:59:17 +03:00
|
|
|
@output = [Virtual::StringConstant.new('hello')]
|
2014-06-29 19:05:35 +03:00
|
|
|
check
|
2014-06-26 17:52:15 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|