metamorpher 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8735660dd5f257c643ffb8eb2efaa66b3a52c455
4
- data.tar.gz: 74a07818202c1ace79822833901584d21632a129
3
+ metadata.gz: 2c4f704cae28a8951e086540e0dfed90457dc1df
4
+ data.tar.gz: d45978633dc0e95f96ddaa2291bd4ccfb5044d2b
5
5
  SHA512:
6
- metadata.gz: c97328c5e7eb49f4db89913aa66d03cfa6f92820c424548e97492e0f48f6e29a04120a0bfb6db71ea4d3ca7d913a13f68a11656eff47372ac32a45636a4d21c5
7
- data.tar.gz: d016159edfb874d20abdfe117c38621f8e36f82eda6ff7b9a6e50ebce2790690954af94df5296adbad7bf69e117a18532140cc71b0abf815df2f951e128ab617
6
+ metadata.gz: 9fb0d338c247084f0fbf6111b22294ef7b7e32bb44a425daf28ff21dedd6206822c25ddd7095745c71a22c6dcdb59363733fb8efbef5a75efd70a30a120a43b0
7
+ data.tar.gz: 9ed773ae45e81245ef5e61cf57d8170b9d9206dbe7eaba2eea4795b657ff973c8a9b78bb9fc55473060a89b020234a9a9236e08b41838dc12d96a327fc4d77df
@@ -1,5 +1,8 @@
1
1
  # Release History
2
2
 
3
+ ## v0.2.6 (15 March 2016)
4
+ * Fix bugs in unparsing Ruby programs containing `[]` and `{}` literals.
5
+
3
6
  ## v0.2.5 (12 March 2016)
4
7
  * Fix bugs that caused mutators to have side-effects when applied to overlapping ASTs.
5
8
 
@@ -59,7 +59,7 @@ module Metamorpher
59
59
  # omitting a necessary keyword. Note that these are the symbols produced
60
60
  # by Parser which are not necessarily the same as Ruby keywords (e.g.,
61
61
  # Parser sometimes produces a :zsuper node for a program of the form "super")
62
- @keywords ||= %i(nil false true self)
62
+ @keywords ||= %i(nil false true self array hash)
63
63
  end
64
64
 
65
65
  def ast_for(literal)
@@ -1,3 +1,3 @@
1
1
  module Metamorpher
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
@@ -86,6 +86,34 @@ module Metamorpher
86
86
  end
87
87
  end
88
88
  end
89
+
90
+ { "[]" => :array, "{}" => :hash }.each do |ruby_literal, type|
91
+ describe "for a program containing the '#{ruby_literal}' Ruby literal" do
92
+ let(:source) { "a = #{ruby_literal}" }
93
+ let(:metamorpher_literal) { builder.lvasgn(:a, type) }
94
+
95
+ it "should parse to the correct metamorpher literal" do
96
+ expect(subject.parse(source)).to eq(metamorpher_literal)
97
+ end
98
+
99
+ it "should unparse to the correct source" do
100
+ expect(subject.unparse(metamorpher_literal)).to eq(source)
101
+ end
102
+ end
103
+
104
+ describe "for a program that is the '#{ruby_literal}' Ruby literal" do
105
+ let(:source) { ruby_literal }
106
+ let(:metamorpher_literal) { builder.literal! type }
107
+
108
+ it "should parse to the correct metamorpher literal" do
109
+ expect(subject.parse(source)).to eq(metamorpher_literal)
110
+ end
111
+
112
+ it "should unparse to the correct source" do
113
+ expect(subject.unparse(metamorpher_literal)).to eq(source)
114
+ end
115
+ end
116
+ end
89
117
  end
90
118
  end
91
119
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metamorpher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis Rose
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-12 00:00:00.000000000 Z
11
+ date: 2016-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attributable