test/display_test.rb in iba-0.0.1 vs test/display_test.rb in iba-0.0.2

- old
+ new

@@ -1,17 +1,21 @@ require File.expand_path('test_helper.rb', File.dirname(__FILE__)) # Test how the combinator displays the parsed block contents. class DisplayTest < Test::Unit::TestCase def test_empty_combinator - assert_equal "", combinator { }.to_s + assert_equal "nil", combinator { }.to_s end - def test_literal + def test_literal_number assert_equal "23", combinator { 23 }.to_s end + def test_literal_string + assert_equal "\"aa\"", combinator { "aa" }.to_s + end + def test_method_calls assert_equal "foo", combinator { foo }.to_s assert_equal "foo.foo", combinator { foo.foo }.to_s assert_equal "foo.foo(1)", combinator { foo.foo 1 }.to_s assert_equal "foo(1)", combinator { foo 1 }.to_s @@ -42,7 +46,12 @@ assert_equal "-foo", combinator { -foo }.to_s end def test_operator_if_wont_work assert_equal "bar", combinator { foo ? bar : baz }.to_s + end + + def test_defined_instance_variables + @foo = 1 + assert_equal "@foo", combinator { @foo }.to_s end end