Sha256: 1b76be46169cf30498fe1314dfe44ca9cca956c3d5edfa67dc80e76670990479

Contents?: true

Size: 970 Bytes

Versions: 18

Compression:

Stored size: 970 Bytes

Contents

module Mutant
  class Mutator
    class Node
      class Literal < self
        # Mutator for regexp literals
        class Regex < self

          handle(Rubinius::AST::RegexLiteral)

        private

          # Emit mutants
          #
          # @return [undefined]
          #
          # @api private
          #
          def dispatch
            emit_nil
            emit_self('') # match all
            emit_self('a\A') # match nothing
            emit_new { new_self(Random.hex_string) }
          end

          # Return new Rubinius::AST::Regex
          #
          # @param [String] source
          #
          # @param [Integer] options
          #   options of regexp, defaults to mutation subject node options
          #
          # @return [undefined]
          #
          # @api private
          #
          def new_self(source,options=nil)
            super(source,options || node.options)
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mutant-0.2.20 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.17 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.16 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.15 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.14 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.13 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.12 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.11 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.9 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.8 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.7 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.6 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.5 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.4 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.3 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.2 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.1 lib/mutant/mutator/node/literal/regex.rb
mutant-0.2.0 lib/mutant/mutator/node/literal/regex.rb