2018-09-12 10:21:24 -04:00
|
|
|
# frozen_string_literal: true
|
2018-09-12 09:15:43 -04:00
|
|
|
|
2016-07-24 17:39:59 -04:00
|
|
|
Mutant::Meta::Example.add :regexp do
|
|
|
|
source '/foo/'
|
|
|
|
|
|
|
|
singleton_mutations
|
2016-08-14 17:25:52 -04:00
|
|
|
regexp_mutations
|
2016-07-24 17:39:59 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
Mutant::Meta::Example.add :regexp do
|
|
|
|
source '/#{foo.bar}n/'
|
|
|
|
|
|
|
|
singleton_mutations
|
2016-08-14 17:25:52 -04:00
|
|
|
regexp_mutations
|
|
|
|
|
2016-07-24 17:39:59 -04:00
|
|
|
mutation '/#{foo}n/'
|
|
|
|
mutation '/#{self.bar}n/'
|
|
|
|
mutation '/#{nil}n/'
|
|
|
|
mutation '/#{self}n/'
|
|
|
|
end
|
|
|
|
|
|
|
|
Mutant::Meta::Example.add :regexp do
|
|
|
|
source '/#{foo}/'
|
|
|
|
|
|
|
|
singleton_mutations
|
2016-08-14 17:25:52 -04:00
|
|
|
regexp_mutations
|
|
|
|
|
2016-07-24 17:39:59 -04:00
|
|
|
mutation '/#{self}/'
|
|
|
|
mutation '/#{nil}/'
|
|
|
|
end
|
|
|
|
|
|
|
|
Mutant::Meta::Example.add :regexp do
|
|
|
|
source '/#{foo}#{nil}/'
|
|
|
|
|
|
|
|
singleton_mutations
|
2016-08-14 17:25:52 -04:00
|
|
|
regexp_mutations
|
|
|
|
|
2016-07-24 17:39:59 -04:00
|
|
|
mutation '/#{nil}#{nil}/'
|
|
|
|
mutation '/#{self}#{nil}/'
|
|
|
|
end
|
|
|
|
|
|
|
|
Mutant::Meta::Example.add :regexp do
|
|
|
|
source '//'
|
|
|
|
|
|
|
|
singleton_mutations
|
|
|
|
|
|
|
|
# match no input
|
|
|
|
mutation '/nomatch\A/'
|
|
|
|
end
|
|
|
|
|
|
|
|
Mutant::Meta::Example.add :regexp do
|
|
|
|
source 'true if /foo/'
|
|
|
|
|
|
|
|
singleton_mutations
|
|
|
|
mutation 'false if /foo/'
|
|
|
|
mutation 'nil if /foo/'
|
|
|
|
mutation 'true if true'
|
|
|
|
mutation 'true if false'
|
|
|
|
mutation 'true if nil'
|
|
|
|
mutation 'true'
|
|
|
|
|
|
|
|
# match all inputs
|
|
|
|
mutation 'true if //'
|
|
|
|
|
|
|
|
# match no input
|
|
|
|
mutation 'true if /nomatch\A/'
|
|
|
|
end
|
|
|
|
|
|
|
|
Mutant::Meta::Example.add :regexp do
|
|
|
|
source '/(?(1)(foo)(bar))/'
|
|
|
|
|
|
|
|
singleton_mutations
|
2016-08-14 17:25:52 -04:00
|
|
|
regexp_mutations
|
2018-09-28 04:23:09 -04:00
|
|
|
|
|
|
|
mutation '/(?(1)(?:foo)(bar))/'
|
|
|
|
mutation '/(?(1)(foo)(?:bar))/'
|
2016-07-24 17:39:59 -04:00
|
|
|
end
|
|
|
|
|
2018-12-24 10:41:15 -05:00
|
|
|
# Case where MRI would accept an expression but regexp_parser not.
|
|
|
|
Mutant::Meta::Example.add :regexp do
|
|
|
|
source '/u{/'
|
|
|
|
|
|
|
|
singleton_mutations
|
|
|
|
mutation '//'
|
|
|
|
mutation '/nomatch\A/'
|
|
|
|
end
|
|
|
|
|
2016-07-24 17:39:59 -04:00
|
|
|
Pathname
|
|
|
|
.glob(Pathname.new(__dir__).join('regexp', '*.rb'))
|
|
|
|
.sort
|
|
|
|
.each(&Kernel.public_method(:require))
|