sexp_processor 3.0.7 → 3.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ === 3.0.8 / 2011-11-16
2
+
3
+ * 4 minor enhancements:
4
+
5
+ * Add 6 missing ruby 1.9 tests (brynary)
6
+ * Added new 1.9 hash tests to pt_testcase.rb
7
+ * Version specific tests are now skipped at runtime, not test creation time
8
+ * Added new block arg tests.
9
+
1
10
  === 3.0.7 / 2011-09-21
2
11
 
3
12
  * 2 bug fixes:
data/lib/pt_testcase.rb CHANGED
@@ -72,12 +72,10 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
72
72
  end
73
73
 
74
74
  def self.add_18tests name, hash
75
- return unless RUBY_VERSION >= "1.8" and RUBY_VERSION < "1.9"
76
75
  add_tests "#{name}__18", hash
77
76
  end
78
77
 
79
78
  def self.add_19tests name, hash
80
- return unless RUBY_VERSION >= "1.9"
81
79
  add_tests "#{name}__19", hash
82
80
  end
83
81
 
@@ -98,9 +96,14 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
98
96
  end
99
97
 
100
98
  def self.generate_test klass, node, data, input_name, output_name
101
- klass.send(:define_method, "test_#{node}".to_sym) do
99
+ klass.send :define_method, "test_#{node}" do
102
100
  flunk "Processor is nil" if processor.nil?
103
101
 
102
+ if node =~ /(1[89])$/ then
103
+ version = $1
104
+ skip "version specific test" unless self.class.name =~ /#{version}/
105
+ end
106
+
104
107
  assert data.has_key?(input_name), "Unknown input data"
105
108
  assert data.has_key?(output_name), "Missing test data"
106
109
 
@@ -128,7 +131,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
128
131
  # body into an assertion. It'll allow subclasses to hook in
129
132
  # and add behavior before or after the processor does it's
130
133
  # thing. If you go the body refactor route, some of the
131
- # RawParseTree test casese fail for completely bogus reasons.
134
+ # RawParseTree test cases fail for completely bogus reasons.
132
135
 
133
136
  before_process_hook klass, node, data, input_name, output_name
134
137
  refute_nil data[input_name], "testcase does not exist?"
@@ -846,6 +849,11 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
846
849
  "ParseTree" => s(:call, s(:call, nil, :o, s(:arglist)), :puts,
847
850
  s(:arglist, s(:lit, 42))))
848
851
 
852
+ add_tests("call_no_space_symbol",
853
+ "Ruby" => "foo:bar",
854
+ "RawParseTree" => [:call, nil, :foo, [:array, [:lit, :bar]]],
855
+ "ParseTree" => s(:call, nil, :foo, s(:arglist, s(:lit, :bar))))
856
+
849
857
  add_tests("call_arglist_hash",
850
858
  "Ruby" => "o.m(:a => 1, :b => 2)",
851
859
  "RawParseTree" => [:call,
@@ -4506,6 +4514,38 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4506
4514
  s(:args, :"*rest", :mand),
4507
4515
  s(:scope, s(:block, s(:nil)))))
4508
4516
 
4517
+ add_19tests("defn_args_mand_opt_splat_mand",
4518
+ "Ruby" => "def f(mand1, opt = 42, *rest, mand2)\n # do nothing\nend",
4519
+ "ParseTree" => s(:defn, :f,
4520
+ s(:args, :mand1, :opt, :"*rest", :mand2,
4521
+ s(:block,
4522
+ s(:lasgn, :opt, s(:lit, 42)))),
4523
+ s(:scope, s(:block, s(:nil)))))
4524
+
4525
+ add_19tests("defn_args_mand_opt_mand",
4526
+ "Ruby" => "def f(mand1, opt = 42, mand2)\n # do nothing\nend",
4527
+ "ParseTree" => s(:defn, :f,
4528
+ s(:args, :mand1, :opt, :mand2,
4529
+ s(:block,
4530
+ s(:lasgn, :opt, s(:lit, 42)))),
4531
+ s(:scope, s(:block, s(:nil)))))
4532
+
4533
+ add_19tests("defn_args_opt_splat_mand",
4534
+ "Ruby" => "def f(opt = 42, *rest, mand)\n # do nothing\nend",
4535
+ "ParseTree" => s(:defn, :f,
4536
+ s(:args, :opt, :"*rest", :mand,
4537
+ s(:block,
4538
+ s(:lasgn, :opt, s(:lit, 42)))),
4539
+ s(:scope, s(:block, s(:nil)))))
4540
+
4541
+ add_19tests("defn_args_opt_mand",
4542
+ "Ruby" => "def f(opt = 42, mand)\n # do nothing\nend",
4543
+ "ParseTree" => s(:defn, :f,
4544
+ s(:args, :opt, :mand,
4545
+ s(:block,
4546
+ s(:lasgn, :opt, s(:lit, 42)))),
4547
+ s(:scope, s(:block, s(:nil)))))
4548
+
4509
4549
  add_19tests("defn_args_splat_middle",
4510
4550
  "Ruby" => "def f(first, *middle, last)\n # do nothing\nend",
4511
4551
  "RawParseTree" => [:defn, :f,
@@ -4539,6 +4579,22 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4539
4579
  s(:lit, :a), s(:lit, 1),
4540
4580
  s(:lit, :b), s(:lit, 2)))
4541
4581
 
4582
+ add_19tests("hash_new_no_space",
4583
+ "Ruby" => "{a:1,b:2}",
4584
+ "RawParseTree" => [:hash,
4585
+ [:lit, :a], [:lit, 1],
4586
+ [:lit, :b], [:lit, 2]],
4587
+ "ParseTree" => s(:hash,
4588
+ s(:lit, :a), s(:lit, 1),
4589
+ s(:lit, :b), s(:lit, 2)))
4590
+
4591
+ add_19tests("lambda_args_block",
4592
+ "Ruby" => "lambda { |&block| block }",
4593
+ "ParseTree" => s(:iter,
4594
+ s(:call, nil, :lambda, s(:arglist)),
4595
+ s(:lasgn, :"&block"),
4596
+ s(:lvar, :block)))
4597
+
4542
4598
  add_19tests("lambda_args_0",
4543
4599
  "Ruby" => "->(){ (x + 1) }",
4544
4600
  "RawParseTree" => [:iter,
@@ -4615,6 +4671,91 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4615
4671
  s(:call, s(:call, nil, :x, s(:arglist)),
4616
4672
  :+, s(:arglist, s(:lit, 1)))))
4617
4673
 
4674
+ add_19tests("lambda_args_no_do",
4675
+ "Ruby" => "-> do (x + 1) end",
4676
+ "RawParseTree" => [:iter,
4677
+ [:fcall, :lambda],
4678
+ nil,
4679
+ [:call, [:vcall, :x], :+,
4680
+ [:array, [:lit, 1]]]],
4681
+ "ParseTree" => s(:iter,
4682
+ s(:call, nil, :lambda, s(:arglist)),
4683
+ nil,
4684
+ s(:call, s(:call, nil, :x, s(:arglist)),
4685
+ :+, s(:arglist, s(:lit, 1)))))
4686
+
4687
+ add_19tests("lambda_args_0_do",
4688
+ "Ruby" => "->() do (x + 1) end",
4689
+ "RawParseTree" => [:iter,
4690
+ [:fcall, :lambda],
4691
+ 0,
4692
+ [:call, [:vcall, :x], :+,
4693
+ [:array, [:lit, 1]]]],
4694
+ "ParseTree" => s(:iter,
4695
+ s(:call, nil, :lambda, s(:arglist)),
4696
+ 0,
4697
+ s(:call,
4698
+ s(:call, nil, :x, s(:arglist)),
4699
+ :+,
4700
+ s(:arglist, s(:lit, 1)))))
4701
+
4702
+ add_19tests("lambda_args_1_do",
4703
+ "Ruby" => "-> (x) do (x + 1) end",
4704
+ "RawParseTree" => [:iter,
4705
+ [:fcall, :lambda],
4706
+ [:dasgn_curr, :x],
4707
+ [:call, [:dvar, :x], :+, [:array, [:lit, 1]]]],
4708
+ "ParseTree" => s(:iter,
4709
+ s(:call, nil, :lambda, s(:arglist)),
4710
+ s(:lasgn, :x),
4711
+ s(:call, s(:lvar, :x), :+,
4712
+ s(:arglist, s(:lit, 1)))))
4713
+
4714
+ add_19tests("lambda_args_2_do",
4715
+ "Ruby" => "-> (x, y) do (x + y) end",
4716
+ "RawParseTree" => [:iter,
4717
+ [:fcall, :lambda],
4718
+ [:masgn, [:array,
4719
+ [:dasgn_curr, :x],
4720
+ [:dasgn_curr, :y]], nil, nil],
4721
+ [:call, [:dvar, :x], :+,
4722
+ [:array, [:dvar, :y]]]],
4723
+ "ParseTree" => s(:iter,
4724
+ s(:call, nil, :lambda, s(:arglist)),
4725
+ s(:masgn,
4726
+ s(:array,
4727
+ s(:lasgn, :x),
4728
+ s(:lasgn, :y))),
4729
+ s(:call, s(:lvar, :x), :+,
4730
+ s(:arglist, s(:lvar, :y)))))
4731
+
4732
+ add_19tests("lambda_args_2_no_parens_do",
4733
+ "Ruby" => "-> x, y do (x + y) end",
4734
+ "RawParseTree" => [:iter,
4735
+ [:fcall, :lambda],
4736
+ [:masgn, [:array,
4737
+ [:dasgn_curr, :x],
4738
+ [:dasgn_curr, :y]], nil, nil],
4739
+ [:call, [:dvar, :x], :+,
4740
+ [:array, [:dvar, :y]]]],
4741
+ "ParseTree" => s(:iter,
4742
+ s(:call, nil, :lambda, s(:arglist)),
4743
+ s(:masgn,
4744
+ s(:array,
4745
+ s(:lasgn, :x),
4746
+ s(:lasgn, :y))),
4747
+ s(:call, s(:lvar, :x), :+,
4748
+ s(:arglist, s(:lvar, :y)))))
4749
+
4750
+ add_19tests("hash_new_with_keyword",
4751
+ "Ruby" => "{ true: 1, b: 2 }",
4752
+ "RawParseTree" => [:hash,
4753
+ [:lit, :true], [:lit, 1],
4754
+ [:lit, :b], [:lit, 2]],
4755
+ "ParseTree" => s(:hash,
4756
+ s(:lit, :true), s(:lit, 1),
4757
+ s(:lit, :b), s(:lit, 2)))
4758
+
4618
4759
  add_19tests("splat_fcall_middle",
4619
4760
  "Ruby" => "meth(1, *[2], 3)",
4620
4761
  "RawParseTree" => [:fcall, :meth,
@@ -34,7 +34,7 @@ require 'sexp'
34
34
 
35
35
  class SexpProcessor
36
36
 
37
- VERSION = '3.0.7'
37
+ VERSION = '3.0.8'
38
38
 
39
39
  ##
40
40
  # Automatically shifts off the Sexp type before handing the
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sexp_processor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 7
10
- version: 3.0.7
9
+ - 8
10
+ version: 3.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Davis
@@ -36,7 +36,7 @@ cert_chain:
36
36
  FBHgymkyj/AOSqKRIpXPhjC6
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2011-09-22 00:00:00 Z
39
+ date: 2011-11-17 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rdoc
@@ -61,11 +61,11 @@ dependencies:
61
61
  requirements:
62
62
  - - ~>
63
63
  - !ruby/object:Gem::Version
64
- hash: 9
64
+ hash: 13
65
65
  segments:
66
66
  - 2
67
- - 5
68
- version: "2.5"
67
+ - 7
68
+ version: "2.7"
69
69
  type: :development
70
70
  version_requirements: *id002
71
71
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file