Some docs and to_s testing
somewhat code_climate inspired
This commit is contained in:
@ -60,6 +60,9 @@ module Ruby
|
||||
def test_integer
|
||||
assert_equal IntegerConstant , compile_const( "123")
|
||||
end
|
||||
def test_float
|
||||
assert_equal FloatConstant , compile_const( "123.1")
|
||||
end
|
||||
def test_string
|
||||
assert_equal StringConstant , compile_const( "'string'")
|
||||
end
|
||||
@ -76,4 +79,36 @@ module Ruby
|
||||
assert_equal TrueConstant , compile_const( "true")
|
||||
end
|
||||
end
|
||||
class TestBasicTypesVool < MiniTest::Test
|
||||
include RubyTests
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
end
|
||||
def compile_const( input )
|
||||
lst = compile( input )
|
||||
lst.to_vool.to_s
|
||||
end
|
||||
def test_integer
|
||||
assert_equal "123" , compile_const( "123")
|
||||
end
|
||||
def test_float
|
||||
assert_equal "123.0" , compile_const( "123.0")
|
||||
end
|
||||
def test_string
|
||||
assert_equal "'string'" , compile_const( "'string'")
|
||||
end
|
||||
def test_sym
|
||||
assert_equal "'symbol'" , compile_const( ":symbol")
|
||||
end
|
||||
def test_nil
|
||||
assert_equal "nil" , compile_const( "nil")
|
||||
end
|
||||
def test_false
|
||||
assert_equal "false" , compile_const( "false")
|
||||
end
|
||||
def test_true
|
||||
assert_equal "true" , compile_const( "true")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -37,5 +37,9 @@ module Ruby
|
||||
assert_equal TrueConstant , lst.if_true.class
|
||||
assert_equal FalseConstant, lst.if_false.class
|
||||
end
|
||||
def test_to_s
|
||||
lst = compile( double_if )
|
||||
assert_equal "if(false);true;else;false;end" , lst.to_s.gsub("\n",";")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -18,6 +18,9 @@ module Ruby
|
||||
def test_simple_args
|
||||
assert_equal [] , @lst.arguments
|
||||
end
|
||||
def test_tos
|
||||
assert_equal "self.foo()" , @lst.to_s
|
||||
end
|
||||
end
|
||||
class TestSendBar < MiniTest::Test
|
||||
include RubyTests
|
||||
|
@ -28,5 +28,8 @@ module Ruby
|
||||
def test_block_args
|
||||
assert_equal IntegerConstant , @lst.arguments.first.class
|
||||
end
|
||||
def test_tos
|
||||
assert_equal "yield(0)" , @lst.to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user