rubyx/test/compiler/expressions/test_basic.rb

48 lines
706 B
Ruby
Raw Normal View History

2015-07-19 09:54:36 +02:00
require_relative "compiler_helper"
2014-06-26 16:52:15 +02:00
2015-07-18 14:28:57 +02:00
2014-06-26 16:52:15 +02:00
class TestBasic < MiniTest::Test
2015-10-10 09:02:28 +02:00
include CompilerHelper
2015-10-10 09:02:28 +02:00
def setup
@root = :basic_type
@output = Register::RegisterValue
2015-07-18 14:28:57 +02:00
end
2014-07-01 14:57:13 +02:00
2014-06-26 16:52:15 +02:00
def test_number
@string_input = '42 '
assert_equal 42 , check.value
2014-06-26 16:52:15 +02:00
end
2014-07-01 14:57:13 +02:00
def test_true
@string_input = 'true'
2014-07-01 14:57:13 +02:00
check
end
def test_false
@string_input = 'false '
check
end
def test_nil
@string_input = 'nil '
check
end
2015-09-27 15:06:48 +02:00
def test_var
@string_input = 'int foo '
2015-10-10 09:02:28 +02:00
@root = :field_def
@output = AST::Node
2014-06-29 18:05:35 +02:00
check
2014-06-26 16:52:15 +02:00
end
def test_self
@string_input = 'self '
check
end
2014-06-26 16:52:15 +02:00
def test_string
@string_input = "\"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