# File test/test_parse_tree.rb, line 2335 2335: def setup 2336: super 2337: @processor = RawParseTree.new(false) 2338: end
# File test/test_parse_tree.rb, line 2349 2349: def test_class_initialize 2350: expected = [[:class, :SomethingWithInitialize, [:const, :Object], 2351: [:defn, :initialize, [:scope, [:block, [:args], [:nil]]]], 2352: [:defn, :protected_meth, [:scope, [:block, [:args], [:nil]]]], 2353: ]] 2354: tree = @processor.parse_tree SomethingWithInitialize 2355: assert_equal expected, tree 2356: end
# File test/test_parse_tree.rb, line 2358 2358: def test_class_translate_string 2359: str = "class A; def a; end; end" 2360: 2361: sexp = ParseTree.translate str 2362: 2363: expected = [:class, :A, nil, 2364: [:scope, 2365: [:defn, :a, [:scope, [:block, [:args], [:nil]]]]]] 2366: 2367: assert_equal expected, sexp 2368: end
# File test/test_parse_tree.rb, line 2370 2370: def test_class_translate_string_method 2371: str = "class A; def a; end; def b; end; end" 2372: 2373: sexp = ParseTree.translate str, :a 2374: 2375: expected = [:defn, :a, [:scope, [:block, [:args], [:nil]]]] 2376: 2377: assert_equal expected, sexp 2378: end
# File test/test_parse_tree.rb, line 2510 2510: def test_missing 2511: assert_equal(@@missing, 2512: @processor.parse_tree_for_method(Something, :missing), 2513: "Must return #{@@missing.inspect} for missing methods") 2514: end
# File test/test_parse_tree.rb, line 2387 2387: def test_parse_tree_for_str 2388: actual = @processor.parse_tree_for_str '1 + nil', '(string)', 1 2389: expected = [[:call, [:lit, 1], :+, [:array, [:nil]]]] 2390: 2391: assert_equal expected, actual 2392: end
# File test/test_parse_tree.rb, line 2380 2380: def test_parse_tree_for_string 2381: actual = @processor.parse_tree_for_string '1 + nil', '(string)', 1 2382: expected = [[:call, [:lit, 1], :+, [:array, [:nil]]]] 2383: 2384: assert_equal expected, actual 2385: end
# File test/test_parse_tree.rb, line 2340 2340: def test_parse_tree_for_string_with_newlines 2341: @processor = RawParseTree.new(true) 2342: actual = @processor.parse_tree_for_string "1 +\n nil", 'test.rb', 5 2343: expected = [[:newline, 6, "test.rb", 2344: [:call, [:lit, 1], :+, [:array, [:nil]]]]] 2345: 2346: assert_equal expected, actual 2347: end
# File test/test_parse_tree.rb, line 2522 2522: def test_process_modules 2523: exp = [[:module, :Mod1, [:defn, :mod_method, [:bmethod, nil]]]] 2524: assert_equal exp, @processor.parse_tree(Mod1) 2525: 2526: exp = [[:module, :Mod2, [:fcall, :include, [:array, [:const, :Mod1]]]]] 2527: assert_equal exp, @processor.parse_tree(Mod2) 2528: 2529: exp = [[:class, :ClassInclude, [:const, :Object], 2530: [:fcall, :include, [:array, [:const, :Mod2]]]]] 2531: assert_equal exp, @processor.parse_tree(ClassInclude) 2532: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.