Class: Henitai::StillbornFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/henitai/stillborn_filter.rb

Overview

Suppresses mutants that do not produce syntactically valid Ruby.

Instance Method Summary collapse

Instance Method Details

#suppressed?(mutant) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
16
# File 'lib/henitai/stillborn_filter.rb', line 8

def suppressed?(mutant)
  source = render(mutant)
  return true unless source

  RubyVM::InstructionSequence.compile(wrapped_source(source))
  false
rescue SyntaxError
  true
end