Class: TestUnifier
- Inherits:
-
MiniTest::Unit::TestCase
- Object
- MiniTest::Unit::TestCase
- TestUnifier
- Defined in:
- lib/parsetree/test/test_unified_ruby.rb
Instance Method Summary collapse
Instance Method Details
#test_pre_call ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/parsetree/test/test_unified_ruby.rb', line 26 def test_pre_call u = PreUnifier.new input = [:call, [:self], :method] expect = s(:call, s(:self), :method, s(:arglist)) assert_equal expect, u.process(input) input = [:fcall, :m, [:array, [:lit, 42]]] expect = s(:fcall, :m, s(:arglist, s(:lit, 42))) assert_equal expect, u.process(input) end |
#test_pre_fcall ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/parsetree/test/test_unified_ruby.rb', line 12 def test_pre_fcall u = PreUnifier.new input = [:fcall, :block_given?] expect = s(:fcall, :block_given?, s(:arglist)) assert_equal expect, u.process(input) input = [:fcall, :m, [:array, [:lit, 42]]] expect = s(:fcall, :m, s(:arglist, s(:lit, 42))) assert_equal expect, u.process(input) end |
#test_process_bmethod ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/parsetree/test/test_unified_ruby.rb', line 40 def test_process_bmethod u = Unifier.new raw = [:defn, :myproc3, [:bmethod, [:masgn, [:array, [:dasgn_curr, :a], [:dasgn_curr, :b], [:dasgn_curr, :c]], nil, nil]]] s = s(:defn, :myproc3, s(:args, :a, :b, :c), s(:scope, s(:block))) assert_equal s, u.process(raw) end |