mutiny 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd2e01d59dd079e28a3fa98029de8c55d4d5b705
4
- data.tar.gz: 4b7b13dcbe3563b19d9bf7317f85b2fcebf0509b
3
+ metadata.gz: 346e69f9b36cf9c2a778b2e62bd51571d171e0f1
4
+ data.tar.gz: 7b08e6ec512f813849038ef15ef718d0b415bafd
5
5
  SHA512:
6
- metadata.gz: 8182f9ad54d073ca14bdbe0ce8d583e175551602aaa161fa3de5d1ee02f4bb7cd699f92f5a04ffdb1ea9abb07a80170e35e5045bdd604108353dd4aae84ecc10
7
- data.tar.gz: 0bd7c7bcf5372e7fbafae2c824206957c3864e717c3aab0bf23458d5d7ec4fbade7446775dc552d27294aa8095ae9b9664d06561d33693f3e21f612d9de6b45d
6
+ metadata.gz: 0cdfbdd49e7349e67cc27fc48a28031a4fe3931952c1bdf13d823a99832b93836f0f59e91aae11d1aa6ffb05cc022d1d7d07d21b377cbf99fc457dbf94aef28e
7
+ data.tar.gz: 0229bca2450718da9ed3484c5070fd8a6d524cca72392621582c63ef4e59a107b40d93698ec787913a2b4e454621a05e7b48916e356cd20a2e5de0beac5eed05
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.2
1
+ 2.2.3
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- ruby "2.2.2"
1
+ ruby "2.2.3"
2
2
  source "https://rubygems.org"
3
3
 
4
4
  # Specify your gem's dependencies in mutiny.gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mutiny (0.2.2)
4
+ mutiny (0.2.3)
5
5
  gli (~> 2.13.0)
6
6
  metamorpher (~> 0.2.2)
7
7
  parser (~> 2.2.2)
@@ -18,34 +18,35 @@ GEM
18
18
  childprocess (>= 0.3.6)
19
19
  cucumber (>= 1.1.1)
20
20
  rspec-expectations (>= 2.7.0)
21
- ast (2.1.0)
21
+ ast (2.2.0)
22
22
  astrolabe (1.3.1)
23
23
  parser (~> 2.2)
24
24
  attributable (0.1.0)
25
25
  builder (3.2.2)
26
- childprocess (0.5.6)
26
+ childprocess (0.5.9)
27
27
  ffi (~> 1.0, >= 1.0.11)
28
- codeclimate-test-reporter (0.4.7)
28
+ codeclimate-test-reporter (0.4.8)
29
29
  simplecov (>= 0.7.1, < 1.0.0)
30
30
  concord (0.1.5)
31
31
  adamantium (~> 0.2.0)
32
32
  equalizer (~> 0.0.9)
33
- cucumber (2.0.2)
33
+ cucumber (2.3.2)
34
34
  builder (>= 2.1.2)
35
- cucumber-core (~> 1.2.0)
35
+ cucumber-core (~> 1.4.0)
36
+ cucumber-wire (~> 0.0.1)
36
37
  diff-lcs (>= 1.1.3)
37
- gherkin (~> 2.12)
38
+ gherkin (~> 3.2.0)
38
39
  multi_json (>= 1.7.5, < 2.0)
39
40
  multi_test (>= 0.1.2)
40
- cucumber-core (1.2.0)
41
- gherkin (~> 2.12.0)
41
+ cucumber-core (1.4.0)
42
+ gherkin (~> 3.2.0)
43
+ cucumber-wire (0.0.1)
42
44
  diff-lcs (1.2.5)
43
45
  docile (1.1.5)
44
46
  equalizer (0.0.11)
45
47
  ffi (1.9.10)
46
- gherkin (2.12.2)
47
- multi_json (~> 1.3)
48
- gli (2.13.2)
48
+ gherkin (3.2.0)
49
+ gli (2.13.4)
49
50
  ice_nine (0.11.1)
50
51
  json (1.8.3)
51
52
  memoizable (0.4.2)
@@ -56,11 +57,11 @@ GEM
56
57
  unparser (~> 0.2.4)
57
58
  multi_json (1.11.2)
58
59
  multi_test (0.1.2)
59
- parser (2.2.2.6)
60
+ parser (2.2.3.0)
60
61
  ast (>= 1.1, < 3.0)
61
62
  powerpack (0.1.1)
62
63
  procto (0.0.2)
63
- rainbow (2.0.0)
64
+ rainbow (2.1.0)
64
65
  rake (10.4.2)
65
66
  rspec (3.3.0)
66
67
  rspec-core (~> 3.3.0)
@@ -82,7 +83,7 @@ GEM
82
83
  rainbow (>= 1.99.1, < 3.0)
83
84
  ruby-progressbar (~> 1.4)
84
85
  ruby-progressbar (1.7.5)
85
- simplecov (0.10.0)
86
+ simplecov (0.11.1)
86
87
  docile (~> 1.1.0)
87
88
  json (~> 1.8)
88
89
  simplecov-html (~> 0.10.0)
@@ -102,7 +103,7 @@ PLATFORMS
102
103
 
103
104
  DEPENDENCIES
104
105
  aruba (~> 0.7.0)
105
- bundler (~> 1.10.3)
106
+ bundler (~> 1.11)
106
107
  codeclimate-test-reporter (~> 0.4.6)
107
108
  mutiny!
108
109
  rake (~> 10.4.2)
@@ -110,4 +111,4 @@ DEPENDENCIES
110
111
  rubocop (~> 0.33.0)
111
112
 
112
113
  BUNDLED WITH
113
- 1.10.6
114
+ 1.11.2
data/RELEASES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History
2
2
 
3
+ ## v0.2.3 (26 January 2016)
4
+ * Add mutation name to each mutant written to disk
5
+ * Update to Ruby 2.2.3
6
+
3
7
  ## v0.2.2 (20 January 2016)
4
8
  * Add rudimentary support for stillborn mutants
5
9
  * Better error reporting during mutant generation
@@ -3,12 +3,13 @@ require 'fileutils'
3
3
  module Mutiny
4
4
  module Mutants
5
5
  class Mutant
6
- attr_reader :subject, :code, :stillborn
6
+ attr_reader :subject, :code, :mutation_name, :stillborn
7
7
  alias_method :stillborn?, :stillborn
8
8
 
9
- def initialize(subject: nil, code:)
9
+ def initialize(subject: nil, code:, mutation_name: nil)
10
10
  @subject = subject
11
11
  @code = code
12
+ @mutation_name = mutation_name
12
13
  @stillborn = false
13
14
  end
14
15
 
@@ -52,7 +52,11 @@ module Mutiny
52
52
  def store(directory)
53
53
  path = File.join(directory, identifier)
54
54
  FileUtils.mkdir_p(File.dirname(path))
55
- File.open(path, 'w') { |f| f.write(code) }
55
+ File.open(path, 'w') { |f| f.write(serialised) }
56
+ end
57
+
58
+ def serialised
59
+ "# " + mutation_name + "\n" + code
56
60
  end
57
61
  end
58
62
  end
@@ -9,6 +9,10 @@ module Mutiny
9
9
  def name
10
10
  self.class.name
11
11
  end
12
+
13
+ def short_name
14
+ name.split("::").last
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -24,11 +24,15 @@ module Mutiny
24
24
  private
25
25
 
26
26
  def mutate_one(subject, mutation)
27
- mutation
28
- .mutate_file(subject.path)
29
- .map { |code| Mutant.new(subject: subject, code: code) }
27
+ safely_mutate_file(subject.path, mutation).map do |code|
28
+ Mutant.new(subject: subject, code: code, mutation_name: mutation.short_name)
29
+ end
30
+ end
31
+
32
+ def safely_mutate_file(path, mutation)
33
+ mutation.mutate_file(path)
30
34
  rescue
31
- msg = "Error encountered whilst mutating file at '#{subject.path}' with #{mutation.name}"
35
+ msg = "Error encountered whilst mutating file at '#{path}' with #{mutation.name}"
32
36
  raise Mutation::Error, msg
33
37
  end
34
38
  end
@@ -1,3 +1,3 @@
1
1
  module Mutiny
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
data/mutiny.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_runtime_dependency "gli", "~> 2.13.0"
24
24
  spec.add_runtime_dependency "metamorpher", "~> 0.2.2"
25
25
 
26
- spec.add_development_dependency "bundler", "~> 1.10.3"
26
+ spec.add_development_dependency "bundler", "~> 1.11"
27
27
  spec.add_development_dependency "rake", "~> 10.4.2"
28
28
  spec.add_development_dependency "rspec", "~> 3.3.0"
29
29
  spec.add_development_dependency "aruba", "~> 0.7.0"
@@ -32,4 +32,25 @@ describe "Using Mutiny to generate mutants" do
32
32
  check_file_content(".mutants/calculator/max.5.rb", /if right != left/)
33
33
  check_file_content(".mutants/calculator/max.6.rb", /if right >= left/)
34
34
  end
35
+
36
+ it "should write mutation name to each mutant" do
37
+ cd "calculator"
38
+ run "bundle exec mutiny mutate"
39
+
40
+ check_file_content(".mutants/calculator/min.0.rb", /# RelationalExpressionReplacement/)
41
+ check_file_content(".mutants/calculator/min.1.rb", /# RelationalExpressionReplacement/)
42
+ check_file_content(".mutants/calculator/min.2.rb", /# RelationalOperatorReplacement/)
43
+ check_file_content(".mutants/calculator/min.3.rb", /# RelationalOperatorReplacement/)
44
+ check_file_content(".mutants/calculator/min.4.rb", /# RelationalOperatorReplacement/)
45
+ check_file_content(".mutants/calculator/min.5.rb", /# RelationalOperatorReplacement/)
46
+ check_file_content(".mutants/calculator/min.6.rb", /# RelationalOperatorReplacement/)
47
+
48
+ check_file_content(".mutants/calculator/max.0.rb", /# RelationalExpressionReplacement/)
49
+ check_file_content(".mutants/calculator/max.1.rb", /# RelationalExpressionReplacement/)
50
+ check_file_content(".mutants/calculator/max.2.rb", /# RelationalOperatorReplacement/)
51
+ check_file_content(".mutants/calculator/max.3.rb", /# RelationalOperatorReplacement/)
52
+ check_file_content(".mutants/calculator/max.4.rb", /# RelationalOperatorReplacement/)
53
+ check_file_content(".mutants/calculator/max.5.rb", /# RelationalOperatorReplacement/)
54
+ check_file_content(".mutants/calculator/max.6.rb", /# RelationalOperatorReplacement/)
55
+ end
35
56
  end
@@ -61,6 +61,7 @@ module Mutiny
61
61
  def mutation_for(*codes)
62
62
  instance_double(Mutation).tap do |mutation|
63
63
  allow(mutation).to receive(:mutate_file) { codes }
64
+ allow(mutation).to receive(:short_name) { "Mutation for #{codes}" }
64
65
  end
65
66
  end
66
67
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutiny
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
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-01-20 00:00:00.000000000 Z
11
+ date: 2016-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.10.3
75
+ version: '1.11'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.10.3
82
+ version: '1.11'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
291
  version: '0'
292
292
  requirements: []
293
293
  rubyforge_project:
294
- rubygems_version: 2.4.5
294
+ rubygems_version: 2.4.5.1
295
295
  signing_key:
296
296
  specification_version: 4
297
297
  summary: A tiny mutation testing framework for Ruby