ast 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/README.md +1 -0
- data/Rakefile +1 -1
- data/ast.gemspec +6 -3
- data/lib/ast.rb +3 -3
- data/test/helper.rb +8 -1
- data/test/test_ast.rb +24 -12
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffb0669773d51b4159753b35caed71e3604b05ed
|
4
|
+
data.tar.gz: 44b5ffd4fd2a825983756b00be2bddee94f4a6a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd9233a6247b68f71d084f4e9418110f2d75e9498b94447c2a72c8396eea550a6d25c6004e99b63584cd0770245584d5d3633682f2f95872d27999fd123118e5
|
7
|
+
data.tar.gz: b065211fc576a555764ba0d1c41eb1acaa47b2e9324579e8c1faacc9e82f352338b73d6f916301bff03ab0872cfde241ec45eb62ab1869098fbb5635c17034e6
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/whitequark/ast.png?branch=master)](https://travis-ci.org/whitequark/ast)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/whitequark/ast.png)](https://codeclimate.com/github/whitequark/ast)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/whitequark/ast/badge.png?branch=master)](https://coveralls.io/r/whitequark/ast)
|
5
6
|
|
6
7
|
AST is a small library for working with immutable abstract syntax trees.
|
7
8
|
|
data/Rakefile
CHANGED
data/ast.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'ast'
|
3
|
-
s.version = '1.0.
|
3
|
+
s.version = '1.0.2'
|
4
4
|
s.authors = ["Peter Zotov"]
|
5
5
|
s.email = ["whitequark@whitequark.org"]
|
6
6
|
s.homepage = "http://github.com/whitequark/ast"
|
@@ -12,10 +12,13 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
13
13
|
s.require_paths = ["lib"]
|
14
14
|
|
15
|
-
s.add_development_dependency 'rake',
|
16
|
-
|
15
|
+
s.add_development_dependency 'rake', '~> 10.0'
|
16
|
+
|
17
|
+
s.add_development_dependency 'bacon', '~> 1.2'
|
17
18
|
s.add_development_dependency 'bacon-colored_output'
|
18
19
|
s.add_development_dependency 'simplecov'
|
20
|
+
s.add_development_dependency 'coveralls'
|
21
|
+
|
19
22
|
s.add_development_dependency 'yard'
|
20
23
|
s.add_development_dependency 'kramdown'
|
21
24
|
end
|
data/lib/ast.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -2,6 +2,13 @@ require 'bacon'
|
|
2
2
|
require 'bacon/colored_output'
|
3
3
|
|
4
4
|
require 'simplecov'
|
5
|
-
|
5
|
+
require 'coveralls'
|
6
|
+
|
7
|
+
SimpleCov.start do
|
8
|
+
self.formatter = SimpleCov::Formatter::MultiFormatter[
|
9
|
+
SimpleCov::Formatter::HTMLFormatter,
|
10
|
+
Coveralls::SimpleCov::Formatter
|
11
|
+
]
|
12
|
+
end
|
6
13
|
|
7
14
|
require 'ast'
|
data/test/test_ast.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require 'helper'
|
2
2
|
|
3
3
|
describe AST::Node do
|
4
4
|
extend AST::Sexp
|
@@ -9,7 +9,7 @@ describe AST::Node do
|
|
9
9
|
|
10
10
|
before do
|
11
11
|
@node = AST::Node.new(:node, [ 0, 1 ])
|
12
|
-
@metanode = MetaNode.new(:node, [ 0, 1 ], meta
|
12
|
+
@metanode = MetaNode.new(:node, [ 0, 1 ], :meta => 'value')
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should have accessors for type and children' do
|
@@ -47,7 +47,7 @@ describe AST::Node do
|
|
47
47
|
updated.type.should.equal @node.type
|
48
48
|
updated.children.should.equal [1, 1]
|
49
49
|
|
50
|
-
updated = @metanode.updated(nil, nil, meta
|
50
|
+
updated = @metanode.updated(nil, nil, :meta => 'other_value')
|
51
51
|
updated.meta.should.equal 'other_value'
|
52
52
|
end
|
53
53
|
|
@@ -108,6 +108,18 @@ describe AST::Node do
|
|
108
108
|
(node << s(:integer, 1) << s(:string, "foo")).
|
109
109
|
should.equal s(:array, s(:integer, 1), s(:string, "foo"))
|
110
110
|
end
|
111
|
+
|
112
|
+
begin
|
113
|
+
eval <<-CODE
|
114
|
+
it 'should not trigger a rubinius bug' do
|
115
|
+
bar = [ s(:bar, 1) ]
|
116
|
+
baz = s(:baz, 2)
|
117
|
+
s(:foo, *bar, baz).should.equal s(:foo, s(:bar, 1), s(:baz, 2))
|
118
|
+
end
|
119
|
+
CODE
|
120
|
+
rescue SyntaxError
|
121
|
+
# Running on 1.8, ignore.
|
122
|
+
end
|
111
123
|
end
|
112
124
|
|
113
125
|
describe AST::Processor do
|
@@ -163,11 +175,11 @@ describe AST::Processor do
|
|
163
175
|
it 'should visit every node' do
|
164
176
|
@processor.process(@ast).should.equal @ast
|
165
177
|
@processor.counts.should.equal({
|
166
|
-
root
|
167
|
-
def
|
168
|
-
arglist
|
169
|
-
body
|
170
|
-
invoke
|
178
|
+
:root => 1,
|
179
|
+
:def => 1,
|
180
|
+
:arglist => 1,
|
181
|
+
:body => 1,
|
182
|
+
:invoke => 2,
|
171
183
|
})
|
172
184
|
end
|
173
185
|
|
@@ -201,15 +213,15 @@ describe AST::Processor do
|
|
201
213
|
end
|
202
214
|
|
203
215
|
it 'should refuse to process non-nodes' do
|
204
|
-
|
205
|
-
|
216
|
+
lambda { @processor.process(nil) }.should.raise NoMethodError, %r|to_ast|
|
217
|
+
lambda { @processor.process([]) }.should.raise NoMethodError, %r|to_ast|
|
206
218
|
end
|
207
219
|
|
208
220
|
it 'should allow to visit nodes with process_all(node)' do
|
209
221
|
@processor.process_all s(:foo, s(:bar), s(:integer, 1))
|
210
222
|
@processor.counts.should.equal({
|
211
|
-
bar
|
212
|
-
integer
|
223
|
+
:bar => 1,
|
224
|
+
:integer => 1,
|
213
225
|
})
|
214
226
|
end
|
215
227
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Zotov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: coveralls
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: yard
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|