fixed asserts

This commit is contained in:
Torsten Ruger 2014-04-27 16:09:22 +03:00
parent 5423bc8f7e
commit 96a9cd3270
2 changed files with 4 additions and 5 deletions

View File

@ -19,19 +19,19 @@ class TestNodes < MiniTest::Test
def test_number def test_number
tree = parse "42" tree = parse "42"
assert tree.is_a? Vm::NumberExpression assert_kind_of Vm::NumberExpression , tree
assert_equal 42 , tree.value assert_equal 42 , tree.value
end end
def test_args def test_args
tree = parse "( 42 )" tree = parse "( 42 )"
assert tree.is_a? Hash assert_kind_of Hash , tree
assert tree[:args].is_a? Vm::NumberExpression assert_kind_of Vm::NumberExpression , tree[:args]
assert_equal 42 , tree[:args].value assert_equal 42 , tree[:args].value
end end
def test_arg_list def test_arg_list
@parser = @parser.args @parser = @parser.args
tree = parse "(42, foo)" tree = parse "(42, foo)"
assert_equal Array , tree.class assert_instance_of Array , tree
assert_equal 42 , tree.first.value assert_equal 42 , tree.first.value
assert_equal "foo" , tree.last.name assert_equal "foo" , tree.last.name
end end

View File

@ -1,5 +1,4 @@
require_relative 'helper' require_relative 'helper'
require 'minitest/spec'
class ParserTest < MiniTest::Test class ParserTest < MiniTest::Test