2014-06-26 16:52:15 +02:00
|
|
|
require_relative "virtual_helper"
|
|
|
|
|
|
|
|
class TestBasic < MiniTest::Test
|
|
|
|
include VirtualHelper
|
2014-07-01 14:57:13 +02:00
|
|
|
|
2014-06-26 16:52:15 +02:00
|
|
|
def test_number
|
|
|
|
@string_input = '42 '
|
2015-05-05 13:04:37 +02:00
|
|
|
@output = "-Virtual::NewReturn(:index => 5, :type => Virtual::Integer)*^* :value Virtual::IntegerConstant(:integer => 42)"
|
2014-06-26 16:52:15 +02:00
|
|
|
check
|
|
|
|
end
|
|
|
|
|
2014-07-01 14:57:13 +02:00
|
|
|
def test_true
|
|
|
|
@string_input = 'true '
|
2015-05-05 13:04:37 +02:00
|
|
|
@output = "-Virtual::Return(:index => 5, :type => Virtual::Reference)*^* :value Virtual::TrueConstant(:length => -1)"
|
2014-07-01 14:57:13 +02:00
|
|
|
check
|
|
|
|
end
|
|
|
|
def test_false
|
|
|
|
@string_input = 'false '
|
2015-05-05 13:04:37 +02:00
|
|
|
@output = "-Virtual::Return(:index => 5, :type => Virtual::Reference)*^* :value Virtual::FalseConstant(:length => -1)"
|
2014-07-01 14:57:13 +02:00
|
|
|
check
|
|
|
|
end
|
|
|
|
def test_nil
|
|
|
|
@string_input = 'nil '
|
2015-05-05 13:04:37 +02:00
|
|
|
@output = "-Virtual::Return(:index => 5, :type => Virtual::Reference)*^* :value Virtual::NilConstant(:length => -1)"
|
2014-07-01 14:57:13 +02:00
|
|
|
check
|
|
|
|
end
|
|
|
|
|
2015-05-05 13:04:37 +02:00
|
|
|
def pest_name
|
|
|
|
#TODO
|
2014-06-26 16:52:15 +02:00
|
|
|
@string_input = 'foo '
|
2014-07-18 10:16:56 +02:00
|
|
|
@output = "---RETURN_MARKER- !ruby/object:Virtual::ReturnRETURN_MARKER name: :returnRETURN_MARKER type: !ruby/class 'Virtual::Mystery'RETURN_MARKER"
|
2014-06-29 18:05:35 +02:00
|
|
|
check
|
2014-06-26 16:52:15 +02:00
|
|
|
end
|
|
|
|
|
2014-07-14 13:29:33 +02:00
|
|
|
def test_self
|
|
|
|
@string_input = 'self '
|
2015-05-05 13:04:37 +02:00
|
|
|
@output = "-Virtual::Self(:index => 3, :type => Virtual::Mystery)"
|
2014-07-14 13:29:33 +02:00
|
|
|
check
|
|
|
|
end
|
|
|
|
|
2014-06-26 16:52:15 +02:00
|
|
|
def test_instance_variable
|
|
|
|
@string_input = '@foo_bar '
|
2015-05-05 13:04:37 +02:00
|
|
|
@output = "-Virtual::NewReturn(:index => 5, :type => Virtual::Mystery)"
|
2014-06-29 18:05:35 +02:00
|
|
|
check
|
2014-06-26 16:52:15 +02:00
|
|
|
end
|
|
|
|
|
2015-05-05 13:04:37 +02:00
|
|
|
def pest_module_name
|
2014-06-26 16:52:15 +02:00
|
|
|
@string_input = 'FooBar '
|
2014-08-23 22:57:47 +02:00
|
|
|
@output = "---RETURN_MARKER- &1 !ruby/object:Boot::BootClassRETURN_MARKER instance_methods: []RETURN_MARKER name: :FooBarRETURN_MARKER super_class_name: :ObjectRETURN_MARKER meta_class: !ruby/object:Boot::MetaClassRETURN_MARKER functions: []RETURN_MARKER me_self: *1RETURN_MARKER"
|
2014-06-29 18:05:35 +02:00
|
|
|
check
|
2014-06-26 16:52:15 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_string
|
|
|
|
@string_input = "\"hello\""
|
2015-05-05 13:04:37 +02:00
|
|
|
@output = "-Virtual::Return(:index => 5, :type => Virtual::Reference)*^* :value Virtual::StringConstant(:string => 'hello')"
|
2014-06-29 18:05:35 +02:00
|
|
|
check
|
2014-06-26 16:52:15 +02:00
|
|
|
end
|
|
|
|
|
2015-05-05 13:04:37 +02:00
|
|
|
end
|