metamorpher 0.2.4 → 0.2.5

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: c154a782758c9a6ec14e30786ee56348283a5bee
4
- data.tar.gz: dba3f527a5d5cca415d86f66fbb57ec39d134a8e
3
+ metadata.gz: 8735660dd5f257c643ffb8eb2efaa66b3a52c455
4
+ data.tar.gz: 74a07818202c1ace79822833901584d21632a129
5
5
  SHA512:
6
- metadata.gz: 2e35036abcb0d0c59fa5c3bd34128b2ac96466da12ca2082ba653b18f70df5c883f16d30c0de5629346ccd2abd3eb72497fd63265c9cae3dddf662f6b87afec6
7
- data.tar.gz: 54603a7afb04f3791c3df1e6554c4a8f79a940d505d4afab62848f04cb813ab6732278913604ccedcb8eb306e627a928b0400e6378c5ad0988de5e5306fd46fb
6
+ metadata.gz: c97328c5e7eb49f4db89913aa66d03cfa6f92820c424548e97492e0f48f6e29a04120a0bfb6db71ea4d3ca7d913a13f68a11656eff47372ac32a45636a4d21c5
7
+ data.tar.gz: d016159edfb874d20abdfe117c38621f8e36f82eda6ff7b9a6e50ebce2790690954af94df5296adbad7bf69e117a18532140cc71b0abf815df2f951e128ab617
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.2
1
+ 2.2.3
data/.travis.yml CHANGED
@@ -1,7 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
4
- - jruby
3
+ - 2.2.3
5
4
  addons:
6
5
  code_climate:
7
6
  repo_token: ccac936a51a09e2bd82f13edee996fc2376304e119df9cbb288a6a7ead7f82ce
data/RELEASES.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Release History
2
2
 
3
+ ## v0.2.5 (12 March 2016)
4
+ * Fix bugs that caused mutators to have side-effects when applied to overlapping ASTs.
5
+
3
6
  ## v0.2.4 (23 February 2016)
4
7
  * Fix bug in computing the paths of terms that contain term sets.
5
8
 
@@ -23,7 +23,7 @@ module Metamorpher
23
23
  private
24
24
 
25
25
  def termify(item)
26
- item.is_a?(Terms::Term) ? item : literal!(item)
26
+ item.is_a?(Terms::Term) ? item.dup : literal!(item)
27
27
  end
28
28
  end
29
29
  end
@@ -3,7 +3,7 @@ module Metamorpher
3
3
  module Replacement
4
4
  def replace(path, replacement)
5
5
  if path.empty?
6
- replacement
6
+ replacement.dup
7
7
  else
8
8
  Terms::Literal.new(
9
9
  name: name,
@@ -16,7 +16,7 @@ module Metamorpher
16
16
  end
17
17
 
18
18
  def visit_variable(variable)
19
- substitution_for_variable(variable.name)
19
+ substitution_for_variable(variable.name).dup
20
20
  end
21
21
 
22
22
  def visit_literal(literal)
@@ -1,3 +1,3 @@
1
1
  module Metamorpher
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
data/metamorpher.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_runtime_dependency "parser", "~> 2.2.2"
23
23
  spec.add_runtime_dependency "unparser", "~> 0.2.4"
24
24
 
25
- spec.add_development_dependency "bundler", "~> 1.10.3"
25
+ spec.add_development_dependency "bundler", "~> 1.11"
26
26
  spec.add_development_dependency "rake", "~> 10.4.2"
27
27
  spec.add_development_dependency "rspec", "~> 3.3.0"
28
28
  spec.add_development_dependency "codeclimate-test-reporter", "~> 0.4.6"
@@ -20,31 +20,41 @@ describe "Mutator" do
20
20
 
21
21
  let(:mutatable) do
22
22
  "def compare\n" \
23
- " foo < bar\n" \
24
- " bar < baz\n" \
23
+ " foo < bar < baz\n" \
24
+ " baaz < qux\n" \
25
25
  "end"
26
26
  end
27
27
 
28
28
  let(:mutated) do
29
29
  [
30
30
  "def compare\n" \
31
- " foo > bar\n" \
32
- " bar < baz\n" \
31
+ " (foo < bar) > baz\n" \
32
+ " baaz < qux\n" \
33
33
  "end",
34
34
 
35
35
  "def compare\n" \
36
- " foo == bar\n" \
37
- " bar < baz\n" \
36
+ " (foo < bar) == baz\n" \
37
+ " baaz < qux\n" \
38
38
  "end",
39
39
 
40
40
  "def compare\n" \
41
- " foo < bar\n" \
42
- " bar > baz\n" \
41
+ " foo < bar < baz\n" \
42
+ " baaz > qux\n" \
43
43
  "end",
44
44
 
45
45
  "def compare\n" \
46
- " foo < bar\n" \
47
- " bar == baz\n" \
46
+ " foo < bar < baz\n" \
47
+ " baaz == qux\n" \
48
+ "end",
49
+
50
+ "def compare\n" \
51
+ " foo > bar < baz\n" \
52
+ " baaz < qux\n" \
53
+ "end",
54
+
55
+ "def compare\n" \
56
+ " foo == bar < baz\n" \
57
+ " baaz < qux\n" \
48
58
  "end"
49
59
  ]
50
60
  end
@@ -56,15 +66,6 @@ describe "Mutator" do
56
66
  it "should return the mutated code" do
57
67
  expect(subject.mutate(mutatable)).to eq(mutated)
58
68
  end
59
-
60
- it "should yield for each mutation site" do
61
- expect { |b| subject.mutate(mutatable, &b) }.to yield_successive_args(
62
- site_for(14..22, "foo < bar", "foo > bar"),
63
- site_for(14..22, "foo < bar", "foo == bar"),
64
- site_for(26..34, "bar < baz", "bar > baz"),
65
- site_for(26..34, "bar < baz", "bar == baz")
66
- )
67
- end
68
69
  end
69
70
 
70
71
  describe "for code that cannot be mutated" do
@@ -88,10 +89,12 @@ describe "Mutator" do
88
89
 
89
90
  it "should yield for each mutating site" do
90
91
  expect { |b| subject.mutate_file(mutatable_file, &b) }.to yield_successive_args(
92
+ site_for(14..28, "foo < bar < baz", "(foo < bar) > baz"),
93
+ site_for(14..28, "foo < bar < baz", "(foo < bar) == baz"),
94
+ site_for(32..41, "baaz < qux", "baaz > qux"),
95
+ site_for(32..41, "baaz < qux", "baaz == qux"),
91
96
  site_for(14..22, "foo < bar", "foo > bar"),
92
- site_for(14..22, "foo < bar", "foo == bar"),
93
- site_for(26..34, "bar < baz", "bar > baz"),
94
- site_for(26..34, "bar < baz", "bar == baz")
97
+ site_for(14..22, "foo < bar", "foo == bar")
95
98
  )
96
99
  end
97
100
  end
@@ -154,10 +157,12 @@ describe "Mutator" do
154
157
  mutatable_file,
155
158
  mutated,
156
159
  [
160
+ site_for(14..28, "foo < bar < baz", "(foo < bar) > baz"),
161
+ site_for(14..28, "foo < bar < baz", "(foo < bar) == baz"),
162
+ site_for(32..41, "baaz < qux", "baaz > qux"),
163
+ site_for(32..41, "baaz < qux", "baaz == qux"),
157
164
  site_for(14..22, "foo < bar", "foo > bar"),
158
- site_for(14..22, "foo < bar", "foo == bar"),
159
- site_for(26..34, "bar < baz", "bar > baz"),
160
- site_for(26..34, "bar < baz", "bar == baz")
165
+ site_for(14..22, "foo < bar", "foo == bar")
161
166
  ]
162
167
  ]
163
168
 
@@ -165,10 +170,12 @@ describe "Mutator" do
165
170
  clone_of_mutatable_file,
166
171
  mutated,
167
172
  [
173
+ site_for(14..28, "foo < bar < baz", "(foo < bar) > baz"),
174
+ site_for(14..28, "foo < bar < baz", "(foo < bar) == baz"),
175
+ site_for(32..41, "baaz < qux", "baaz > qux"),
176
+ site_for(32..41, "baaz < qux", "baaz == qux"),
168
177
  site_for(14..22, "foo < bar", "foo > bar"),
169
- site_for(14..22, "foo < bar", "foo == bar"),
170
- site_for(26..34, "bar < baz", "bar > baz"),
171
- site_for(26..34, "bar < baz", "bar == baz")
178
+ site_for(14..22, "foo < bar", "foo == bar")
172
179
  ]
173
180
  ]
174
181
 
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.4
4
+ version: 0.2.5
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-02-23 00:00:00.000000000 Z
11
+ date: 2016-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attributable
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.10.3
61
+ version: '1.11'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.10.3
68
+ version: '1.11'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
242
  version: '0'
243
243
  requirements: []
244
244
  rubyforge_project:
245
- rubygems_version: 2.4.5
245
+ rubygems_version: 2.4.5.1
246
246
  signing_key:
247
247
  specification_version: 4
248
248
  summary: A term rewriting library for transforming (Ruby) programs