mutant 0.5.23 → 0.5.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +10 -0
  3. data/config/flay.yml +1 -1
  4. data/config/reek.yml +19 -19
  5. data/lib/mutant.rb +12 -39
  6. data/lib/mutant/ast.rb +5 -0
  7. data/lib/mutant/ast/meta.rb +131 -0
  8. data/lib/mutant/ast/named_children.rb +98 -0
  9. data/lib/mutant/ast/node_predicates.rb +19 -0
  10. data/lib/mutant/ast/nodes.rb +21 -0
  11. data/lib/mutant/ast/sexp.rb +34 -0
  12. data/lib/mutant/ast/types.rb +48 -0
  13. data/lib/mutant/cache.rb +3 -2
  14. data/lib/mutant/cli.rb +11 -151
  15. data/lib/mutant/config.rb +22 -2
  16. data/lib/mutant/context/scope.rb +11 -21
  17. data/lib/mutant/delegator.rb +2 -0
  18. data/lib/mutant/diff.rb +7 -3
  19. data/lib/mutant/env.rb +49 -0
  20. data/lib/mutant/expression.rb +36 -8
  21. data/lib/mutant/expression/methods.rb +62 -0
  22. data/lib/mutant/expression/namespace.rb +41 -28
  23. data/lib/mutant/{strategy.rb → integration.rb} +12 -31
  24. data/lib/mutant/isolation.rb +1 -1
  25. data/lib/mutant/matcher.rb +1 -21
  26. data/lib/mutant/matcher/builder.rb +142 -0
  27. data/lib/mutant/matcher/method.rb +3 -7
  28. data/lib/mutant/matcher/method/instance.rb +6 -5
  29. data/lib/mutant/matcher/method/singleton.rb +2 -7
  30. data/lib/mutant/matcher/methods.rb +11 -14
  31. data/lib/mutant/matcher/namespace.rb +31 -39
  32. data/lib/mutant/matcher/scope.rb +13 -2
  33. data/lib/mutant/meta.rb +0 -1
  34. data/lib/mutant/meta/example/dsl.rb +5 -1
  35. data/lib/mutant/mutator/node.rb +16 -44
  36. data/lib/mutant/mutator/node/or_asgn.rb +1 -1
  37. data/lib/mutant/mutator/node/send.rb +5 -60
  38. data/lib/mutant/mutator/node/super.rb +2 -5
  39. data/lib/mutant/mutator/registry.rb +1 -1
  40. data/lib/mutant/reporter.rb +10 -0
  41. data/lib/mutant/reporter/cli.rb +13 -0
  42. data/lib/mutant/reporter/cli/printer.rb +2 -0
  43. data/lib/mutant/reporter/cli/progress/config.rb +1 -1
  44. data/lib/mutant/reporter/cli/progress/noop.rb +2 -0
  45. data/lib/mutant/reporter/cli/registry.rb +2 -0
  46. data/lib/mutant/reporter/null.rb +12 -0
  47. data/lib/mutant/reporter/trace.rb +4 -0
  48. data/lib/mutant/require_highjack.rb +2 -2
  49. data/lib/mutant/rspec.rb +0 -0
  50. data/lib/mutant/runner.rb +2 -0
  51. data/lib/mutant/runner/config.rb +8 -8
  52. data/lib/mutant/runner/killer.rb +5 -0
  53. data/lib/mutant/runner/subject.rb +1 -1
  54. data/lib/mutant/subject.rb +8 -8
  55. data/lib/mutant/subject/method.rb +3 -2
  56. data/lib/mutant/subject/method/instance.rb +1 -1
  57. data/lib/mutant/test.rb +7 -65
  58. data/lib/mutant/test/report.rb +59 -0
  59. data/lib/mutant/version.rb +1 -1
  60. data/lib/mutant/warning_filter.rb +2 -0
  61. data/lib/mutant/zombifier.rb +3 -0
  62. data/lib/mutant/zombifier/file.rb +1 -1
  63. data/meta/or_asgn.rb +11 -0
  64. data/meta/send.rb +1 -1
  65. data/mutant-rspec.gemspec +1 -1
  66. data/mutant.gemspec +1 -1
  67. data/spec/integration/mutant/corpus_spec.rb +2 -0
  68. data/spec/integration/mutant/test_mutator_handles_types_spec.rb +2 -2
  69. data/spec/spec_helper.rb +4 -3
  70. data/spec/unit/mutant/cli_new_spec.rb +11 -11
  71. data/spec/unit/mutant/expression/methods_spec.rb +43 -0
  72. data/spec/unit/mutant/expression/namespace/flat_spec.rb +1 -1
  73. data/spec/unit/mutant/expression/namespace/recursive_spec.rb +19 -5
  74. data/spec/unit/mutant/{strategy_spec.rb → integration_spec.rb} +1 -1
  75. data/spec/unit/mutant/isolation_spec.rb +3 -1
  76. data/spec/unit/mutant/matcher/method/instance_spec.rb +5 -5
  77. data/spec/unit/mutant/matcher/method/singleton_spec.rb +8 -8
  78. data/spec/unit/mutant/matcher/methods/instance_spec.rb +5 -8
  79. data/spec/unit/mutant/matcher/methods/singleton_spec.rb +5 -5
  80. data/spec/unit/mutant/matcher/namespace_spec.rb +18 -23
  81. data/spec/unit/mutant/mutation_spec.rb +1 -1
  82. data/spec/unit/mutant/runner/config_spec.rb +4 -5
  83. data/spec/unit/mutant/runner/mutation_spec.rb +21 -21
  84. data/spec/unit/mutant/runner/subject_spec.rb +6 -6
  85. data/spec/unit/mutant/subject/method/instance_spec.rb +0 -4
  86. data/spec/unit/mutant/subject/method/singleton_spec.rb +0 -1
  87. data/spec/unit/mutant/subject_spec.rb +3 -3
  88. metadata +20 -6
  89. data/lib/mutant/node_helpers.rb +0 -52
@@ -3,8 +3,8 @@ require 'spec_helper'
3
3
  describe Mutant::Subject do
4
4
  let(:class_under_test) do
5
5
  Class.new(described_class) do
6
- def match_expression
7
- 'match'
6
+ def expression
7
+ Mutant::Expression.parse('Test')
8
8
  end
9
9
  end
10
10
  end
@@ -34,6 +34,6 @@ describe Mutant::Subject do
34
34
  describe '#identification' do
35
35
  subject { object.identification }
36
36
 
37
- it { should eql('match:source_path:source_line') }
37
+ it { should eql('Test:source_path:source_line') }
38
38
  end
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.23
4
+ version: 0.5.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-25 00:00:00.000000000 Z
11
+ date: 2014-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -274,6 +274,13 @@ files:
274
274
  - config/triage.yml
275
275
  - config/yardstick.yml
276
276
  - lib/mutant.rb
277
+ - lib/mutant/ast.rb
278
+ - lib/mutant/ast/meta.rb
279
+ - lib/mutant/ast/named_children.rb
280
+ - lib/mutant/ast/node_predicates.rb
281
+ - lib/mutant/ast/nodes.rb
282
+ - lib/mutant/ast/sexp.rb
283
+ - lib/mutant/ast/types.rb
277
284
  - lib/mutant/cache.rb
278
285
  - lib/mutant/cli.rb
279
286
  - lib/mutant/color.rb
@@ -282,13 +289,17 @@ files:
282
289
  - lib/mutant/context/scope.rb
283
290
  - lib/mutant/delegator.rb
284
291
  - lib/mutant/diff.rb
292
+ - lib/mutant/env.rb
285
293
  - lib/mutant/expression.rb
286
294
  - lib/mutant/expression/method.rb
295
+ - lib/mutant/expression/methods.rb
287
296
  - lib/mutant/expression/namespace.rb
297
+ - lib/mutant/integration.rb
288
298
  - lib/mutant/isolation.rb
289
299
  - lib/mutant/killer.rb
290
300
  - lib/mutant/loader.rb
291
301
  - lib/mutant/matcher.rb
302
+ - lib/mutant/matcher/builder.rb
292
303
  - lib/mutant/matcher/chain.rb
293
304
  - lib/mutant/matcher/filter.rb
294
305
  - lib/mutant/matcher/method.rb
@@ -364,7 +375,6 @@ files:
364
375
  - lib/mutant/mutator/util.rb
365
376
  - lib/mutant/mutator/util/array.rb
366
377
  - lib/mutant/mutator/util/symbol.rb
367
- - lib/mutant/node_helpers.rb
368
378
  - lib/mutant/reporter.rb
369
379
  - lib/mutant/reporter/cli.rb
370
380
  - lib/mutant/reporter/cli/printer.rb
@@ -381,17 +391,18 @@ files:
381
391
  - lib/mutant/reporter/null.rb
382
392
  - lib/mutant/reporter/trace.rb
383
393
  - lib/mutant/require_highjack.rb
394
+ - lib/mutant/rspec.rb
384
395
  - lib/mutant/runner.rb
385
396
  - lib/mutant/runner/config.rb
386
397
  - lib/mutant/runner/killer.rb
387
398
  - lib/mutant/runner/mutation.rb
388
399
  - lib/mutant/runner/subject.rb
389
- - lib/mutant/strategy.rb
390
400
  - lib/mutant/subject.rb
391
401
  - lib/mutant/subject/method.rb
392
402
  - lib/mutant/subject/method/instance.rb
393
403
  - lib/mutant/subject/method/singleton.rb
394
404
  - lib/mutant/test.rb
405
+ - lib/mutant/test/report.rb
395
406
  - lib/mutant/version.rb
396
407
  - lib/mutant/walker.rb
397
408
  - lib/mutant/warning_expectation.rb
@@ -477,8 +488,10 @@ files:
477
488
  - spec/unit/mutant/context/scope/unqualified_name_spec.rb
478
489
  - spec/unit/mutant/diff_spec.rb
479
490
  - spec/unit/mutant/expression/method_spec.rb
491
+ - spec/unit/mutant/expression/methods_spec.rb
480
492
  - spec/unit/mutant/expression/namespace/flat_spec.rb
481
493
  - spec/unit/mutant/expression/namespace/recursive_spec.rb
494
+ - spec/unit/mutant/integration_spec.rb
482
495
  - spec/unit/mutant/isolation_spec.rb
483
496
  - spec/unit/mutant/loader/eval_spec.rb
484
497
  - spec/unit/mutant/matcher/chain_spec.rb
@@ -494,7 +507,6 @@ files:
494
507
  - spec/unit/mutant/runner/config_spec.rb
495
508
  - spec/unit/mutant/runner/mutation_spec.rb
496
509
  - spec/unit/mutant/runner/subject_spec.rb
497
- - spec/unit/mutant/strategy_spec.rb
498
510
  - spec/unit/mutant/subject/context_spec.rb
499
511
  - spec/unit/mutant/subject/method/instance_spec.rb
500
512
  - spec/unit/mutant/subject/method/singleton_spec.rb
@@ -550,8 +562,10 @@ test_files:
550
562
  - spec/unit/mutant/context/scope/unqualified_name_spec.rb
551
563
  - spec/unit/mutant/diff_spec.rb
552
564
  - spec/unit/mutant/expression/method_spec.rb
565
+ - spec/unit/mutant/expression/methods_spec.rb
553
566
  - spec/unit/mutant/expression/namespace/flat_spec.rb
554
567
  - spec/unit/mutant/expression/namespace/recursive_spec.rb
568
+ - spec/unit/mutant/integration_spec.rb
555
569
  - spec/unit/mutant/isolation_spec.rb
556
570
  - spec/unit/mutant/loader/eval_spec.rb
557
571
  - spec/unit/mutant/matcher/chain_spec.rb
@@ -567,7 +581,6 @@ test_files:
567
581
  - spec/unit/mutant/runner/config_spec.rb
568
582
  - spec/unit/mutant/runner/mutation_spec.rb
569
583
  - spec/unit/mutant/runner/subject_spec.rb
570
- - spec/unit/mutant/strategy_spec.rb
571
584
  - spec/unit/mutant/subject/context_spec.rb
572
585
  - spec/unit/mutant/subject/method/instance_spec.rb
573
586
  - spec/unit/mutant/subject/method/singleton_spec.rb
@@ -577,3 +590,4 @@ test_files:
577
590
  - spec/unit/mutant/warning_expectation.rb
578
591
  - spec/unit/mutant/warning_filter_spec.rb
579
592
  - spec/unit/mutant_spec.rb
593
+ has_rdoc:
@@ -1,52 +0,0 @@
1
- module Mutant
2
- # Mixin for node helpers
3
- module NodeHelpers
4
-
5
- # Build node
6
- #
7
- # @param [Symbol] type
8
- #
9
- # @return [Parser::AST::Node]
10
- #
11
- # @api private
12
- #
13
- def s(type, *children)
14
- Parser::AST::Node.new(type, children)
15
- end
16
- module_function :s
17
-
18
- N_NAN = s(:send, s(:float, 0.0), :/, s(:float, 0.0))
19
- N_INFINITY = s(:send, s(:float, 1.0), :/, s(:float, 0.0))
20
- N_NEGATIVE_INFINITY = s(:send, s(:float, -1.0), :/, s(:float, 0.0))
21
- N_RAISE = s(:send, nil, :raise)
22
- N_TRUE = s(:true)
23
- N_FALSE = s(:false)
24
- N_NIL = s(:nil)
25
- N_EMPTY = s(:empty)
26
- N_SELF = s(:self)
27
-
28
- # Build a negated boolean node
29
- #
30
- # @param [Parser::AST::Node] node
31
- #
32
- # @return [Parser::AST::Node]
33
- #
34
- # @api private
35
- #
36
- def n_not(node)
37
- s(:send, node, :!)
38
- end
39
-
40
- NODE_TYPES.each do |type|
41
- fail "method: #{type} is already defined" if instance_methods(true).include?(type)
42
-
43
- name = "n_#{type.to_s.sub(/\??\z/, '?')}"
44
-
45
- define_method(name) do |node|
46
- node.type.equal?(type)
47
- end
48
- private name
49
- end
50
-
51
- end # NodeHelpers
52
- end # Mutant