# File test/test_parse_tree.rb, line 2335 def setup super @processor = RawParseTree.new(false) end
# File test/test_parse_tree.rb, line 2349 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 2358 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 2370 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 2510 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 2387 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 2380 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 2340 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
# File test/test_parse_tree.rb, line 2522 def test_process_modules exp = [[:module, :Mod1, [:defn, :mod_method, [:bmethod, nil]]]] assert_equal exp, @processor.parse_tree(Mod1) exp = [[:module, :Mod2, [:fcall, :include, [:array, [:const, :Mod1]]]]] assert_equal exp, @processor.parse_tree(Mod2) exp = [[:class, :ClassInclude, [:const, :Object], [:fcall, :include, [:array, [:const, :Mod2]]]]] assert_equal exp, @processor.parse_tree(ClassInclude) end
Generated with the Darkfish Rdoc Generator 2.