ripper_ruby_parser 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -291,19 +291,37 @@ describe RipperRubyParser::SexpProcessor do
291
291
  end
292
292
  end
293
293
 
294
- describe "#identifier_node_to_symbol" do
294
+ describe "#extract_node_symbol" do
295
295
  it "processes an identifier sexp to a bare symbol" do
296
296
  sexp = s(:@ident, "foo", s(1, 0))
297
- result = processor.send :identifier_node_to_symbol, sexp
297
+ result = processor.send :extract_node_symbol, sexp
298
298
  result.must_equal :foo
299
299
  end
300
- end
301
300
 
302
- describe "#const_node_to_symbol" do
303
301
  it "processes a const sexp to a bare symbol" do
304
302
  sexp = s(:@const, "Foo", s(1, 0))
305
- result = processor.send :const_node_to_symbol, sexp
303
+ result = processor.send :extract_node_symbol, sexp
306
304
  result.must_equal :Foo
307
305
  end
308
306
  end
307
+
308
+ describe "#trickle_up_line_numbers" do
309
+ it "works through several nested levels" do
310
+ inner = s(:foo)
311
+ outer = s(:bar, s(:baz, s(:qux, inner)))
312
+ outer.line = 42
313
+ processor.send :trickle_down_line_numbers, outer
314
+ inner.line.must_equal 42
315
+ end
316
+ end
317
+
318
+ describe "#trickle_down_line_numbers" do
319
+ it "works through several nested levels" do
320
+ inner = s(:foo)
321
+ inner.line = 42
322
+ outer = s(:bar, s(:baz, s(:qux, inner)))
323
+ processor.send :trickle_up_line_numbers, outer
324
+ outer.line.must_equal 42
325
+ end
326
+ end
309
327
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ripper_ruby_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-11 00:00:00.000000000 Z
12
+ date: 2012-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sexp_processor
16
- requirement: &22169420 !ruby/object:Gem::Requirement
16
+ requirement: &13025240 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.10
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *22169420
24
+ version_requirements: *13025240
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest
27
- requirement: &22168900 !ruby/object:Gem::Requirement
27
+ requirement: &13024720 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.11.2
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *22168900
35
+ version_requirements: *13024720
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &22221020 !ruby/object:Gem::Requirement
38
+ requirement: &13024240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.9.2
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *22221020
46
+ version_requirements: *13024240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: ruby_parser
49
- requirement: &22220540 !ruby/object:Gem::Requirement
49
+ requirement: &13023760 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.3.1
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *22220540
57
+ version_requirements: *13023760
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: simplecov
60
- requirement: &22220160 !ruby/object:Gem::Requirement
60
+ requirement: &13023380 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *22220160
68
+ version_requirements: *13023380
69
69
  description:
70
70
  email:
71
71
  - matijs@matijs.net
@@ -76,6 +76,7 @@ extra_rdoc_files:
76
76
  files:
77
77
  - lib/ripper_ruby_parser.rb
78
78
  - lib/ripper_ruby_parser/sexp_ext.rb
79
+ - lib/ripper_ruby_parser/commenting_sexp_builder.rb
79
80
  - lib/ripper_ruby_parser/sexp_handlers/operators.rb
80
81
  - lib/ripper_ruby_parser/sexp_handlers/methods.rb
81
82
  - lib/ripper_ruby_parser/sexp_handlers/arrays.rb
@@ -95,10 +96,13 @@ files:
95
96
  - test/test_helper.rb
96
97
  - test/end_to_end/lib_comparison_test.rb
97
98
  - test/end_to_end/comparison_test.rb
99
+ - test/end_to_end/comments_test.rb
98
100
  - test/end_to_end/test_comparison_test.rb
101
+ - test/end_to_end/line_numbering_test.rb
99
102
  - test/unit/parser_test.rb
100
103
  - test/unit/sexp_processor_test.rb
101
104
  - test/unit/version_test.rb
105
+ - test/unit/commenting_sexp_builder_test.rb
102
106
  - README.rdoc
103
107
  - Rakefile
104
108
  homepage: http://www.github.com/mvz/ripper_ruby_parser
@@ -128,10 +132,13 @@ signing_key:
128
132
  specification_version: 3
129
133
  summary: Parse with Ripper, produce sexps that are compatible with RubyParser.
130
134
  test_files:
135
+ - test/end_to_end/comments_test.rb
131
136
  - test/end_to_end/comparison_test.rb
132
137
  - test/end_to_end/lib_comparison_test.rb
138
+ - test/end_to_end/line_numbering_test.rb
133
139
  - test/end_to_end/test_comparison_test.rb
134
140
  - test/test_helper.rb
141
+ - test/unit/commenting_sexp_builder_test.rb
135
142
  - test/unit/parser_test.rb
136
143
  - test/unit/sexp_processor_test.rb
137
144
  - test/unit/version_test.rb