forked from mbj/mutant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrescue.rb
84 lines (63 loc) · 2.19 KB
/
rescue.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# frozen_string_literal: true
Mutant::Meta::Example.add :rescue do
source 'begin; rescue ExceptionA, ExceptionB => error; true; end'
singleton_mutations
mutation 'begin; rescue ExceptionA, ExceptionB; true; end'
mutation 'begin; rescue self, ExceptionB => error; true; end'
mutation 'begin; rescue ExceptionA, self => error; true; end'
mutation 'begin; rescue ExceptionA, ExceptionB => error; false; end'
mutation 'begin; true; end'
end
Mutant::Meta::Example.add :rescue do
source 'begin; rescue SomeException => error; true; end'
singleton_mutations
mutation 'begin; rescue SomeException; true; end'
mutation 'begin; rescue SomeException => error; false; end'
mutation 'begin; rescue self => error; true; end'
mutation 'begin; true; end'
end
Mutant::Meta::Example.add :rescue do
source 'begin; rescue => error; true end'
singleton_mutations
mutation 'begin; rescue => error; false; end'
mutation 'begin; rescue; true; end'
mutation 'begin; true; end'
end
Mutant::Meta::Example.add :rescue do
source 'begin; rescue; true end'
singleton_mutations
mutation 'begin; rescue; false; end'
mutation 'begin; true end'
end
Mutant::Meta::Example.add :rescue do
source 'begin; true; end'
singleton_mutations
mutation 'begin; false; end'
end
Mutant::Meta::Example.add :rescue do
source 'def a; foo; rescue; bar; else; baz; end'
# Mutate all bodies
mutation 'def a; nil; rescue; bar; else; baz; end'
mutation 'def a; self; rescue; bar; else; baz; end'
mutation 'def a; foo; rescue; nil; else; baz; end'
mutation 'def a; foo; rescue; self; else; baz; end'
mutation 'def a; foo; rescue; bar; else; nil; end'
mutation 'def a; foo; rescue; bar; else; self; end'
# Promote and concat rescue resbody bodies
mutation 'def a; foo; bar; end'
# Promote and concat else body
mutation 'def a; foo; baz; end'
# Promote rescue body
mutation 'def a; foo; end'
# Empty body
mutation 'def a; end'
# Failing body
mutation 'def a; raise; end'
# Superclass implementation
mutation 'def a; super; end'
end
Mutant::Meta::Example.add :rescue do
source 'begin; rescue; ensure; true; end'
singleton_mutations
mutation 'begin; rescue; ensure; false; end'
end