crude-mutant 0.2.1 → 0.2.2

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
  SHA256:
3
- metadata.gz: 84b41616b8f4a60cf89f845acb820e8460939e6ce8f62ebc4b4562eaf8762b16
4
- data.tar.gz: 697c8567d6117ff9a8630fd9cf9f7095f6459ac132f8974d2bbfe229e58d6698
3
+ metadata.gz: 30c70ccce932ab3310d011413c98acd642aa980de6b6ffd188b2ad76ab524122
4
+ data.tar.gz: 0f40c8889e26dc985309775435efaa3cd6c920deefd655bf221ec445200f5adb
5
5
  SHA512:
6
- metadata.gz: 5995d7d2253c7c0cc85eb1c3f91bc5fae2a4b440394f351288f5372f4ca6359c6366479a26cb12e8f271b9510457f223feda807632f798b49da9d7122dff0978
7
- data.tar.gz: 272f6fedebec06960a8e6e52b68e6b7e5769163b2012527f5611f042704da2eb2a3ceb05c963712cd790a6d9bfad03de19d066fa67d7a6621890d42aa0f5d964
6
+ metadata.gz: fe717c339d38bba664d6f0482453563dc313f81f118096edd75bf17a757d48b57d1bc49eca112ffe2d2ed24339d291e5de61cc4a4c7691f3b788c378c5ab3486
7
+ data.tar.gz: 13635ad04411c19140c8ac3c37e93fd9bab5d002381ba8bd77e15938b6006afe51474948aec8e8ae2a1ed2b1026b79baa69145a4bdcc538c367f46d8c3ac2244
data/.travis.yml CHANGED
@@ -6,4 +6,5 @@ rvm:
6
6
  - 2.6.0
7
7
  - 2.5
8
8
  - 2.4
9
+ - 2.3
9
10
  before_install: gem install bundler -v 1.17.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- crude-mutant (0.2.1)
4
+ crude-mutant (0.2.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # crude-mutant ![https://travis-ci.org/kellysutton/crude-mutant](https://travis-ci.org/kellysutton/crude-mutant.svg?branch=master)
1
+ # crude-mutant [![https://travis-ci.org/kellysutton/crude-mutant](https://travis-ci.org/kellysutton/crude-mutant.svg?branch=master)](https://travis-ci.org/kellysutton/crude-mutant)
2
2
 
3
3
  A Ruby-based, language-agnostic tool for performing [mutation testing](https://en.wikipedia.org/wiki/Mutation_testing) on a file.
4
4
 
data/lib/crude_mutant.rb CHANGED
@@ -14,12 +14,19 @@ require "crude_mutant/version"
14
14
 
15
15
  module CrudeMutant
16
16
  class Error < StandardError; end
17
+ class NeutralCaseError < StandardError; end
17
18
 
18
19
  class << self
19
20
  def start(file_path, test_command, &block)
20
21
  file = FileLoader.load(file_path)
21
22
  num_lines_in_file = file.lines_in_file
22
23
 
24
+ initial_success = Executor.call(test_command)
25
+
26
+ if !initial_success
27
+ raise NeutralCaseError, 'Initial test run did not succeed'
28
+ end
29
+
23
30
  begin
24
31
  line_number = -1
25
32
  test_runs = file.contents_as_array.reduce([]) do |acc, contents|
@@ -10,7 +10,9 @@ module CrudeMutant
10
10
  end
11
11
 
12
12
  def avg_time
13
- @run_results.map(&:time_taken).sum / @run_results.size
13
+ return 0.0 if @run_results.size == 0
14
+
15
+ @run_results.map(&:time_taken).reduce(0, :+) / @run_results.size
14
16
  end
15
17
  end
16
18
  end
@@ -28,6 +28,7 @@ module CrudeMutant
28
28
  stream.print "#{line}"
29
29
  end
30
30
 
31
+ stream.print "\n"
31
32
  stream.print "Finished mutating #{result.file_path}. ^^^ Results above ^^^\n"
32
33
  stream.print "Performed #{result.run_results.size} line mutations in total.\n"
33
34
  stream.print "There are #{red(result.successful_runs_even_with_mutations.size)} #{red('problematic lines')}:\n"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CrudeMutant
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crude-mutant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Sutton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-27 00:00:00.000000000 Z
11
+ date: 2018-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler