# File test/test_parse_tree.rb, line 39 def setup super @processor = RawParseTree.new(false) end
# File test/test_parse_tree.rb, line 53 def test_class_initialize expected = [[:class, :SomethingWithInitialize, [:const, :Object], [:defn, :initialize, [:scope, [:block, [:args], [:nil]]]], [:defn, :protected_meth, [:scope, [:block, [:args], [:nil]]]], ]] tree = @processor.parse_tree SomethingWithInitialize assert_equal expected, tree end
# File test/test_parse_tree.rb, line 62 def test_class_translate_string str = "class A; def a; end; end" sexp = ParseTree.translate str expected = [:class, :A, nil, [:scope, [:defn, :a, [:scope, [:block, [:args], [:nil]]]]]] assert_equal expected, sexp end
# File test/test_parse_tree.rb, line 74 def test_class_translate_string_method str = "class A; def a; end; def b; end; end" sexp = ParseTree.translate str, :a expected = [:defn, :a, [:scope, [:block, [:args], [:nil]]]] assert_equal expected, sexp end
# File test/test_parse_tree.rb, line 214 def test_missing assert_equal(@@missing, @processor.parse_tree_for_method(Something, :missing), "Must return #{@@missing.inspect} for missing methods") end
# File test/test_parse_tree.rb, line 91 def test_parse_tree_for_str actual = @processor.parse_tree_for_str '1 + nil', '(string)', 1 expected = [[:call, [:lit, 1], :+, [:array, [:nil]]]] assert_equal expected, actual end
# File test/test_parse_tree.rb, line 84 def test_parse_tree_for_string actual = @processor.parse_tree_for_string '1 + nil', '(string)', 1 expected = [[:call, [:lit, 1], :+, [:array, [:nil]]]] assert_equal expected, actual end
# File test/test_parse_tree.rb, line 44 def test_parse_tree_for_string_with_newlines @processor = RawParseTree.new(true) actual = @processor.parse_tree_for_string "1 +\n nil", 'test.rb', 5 expected = [[:newline, 6, "test.rb", [:call, [:lit, 1], :+, [:array, [:nil]]]]] assert_equal expected, actual end
Generated with the Darkfish Rdoc Generator 2.