File tree Expand file tree Collapse file tree 5 files changed +63
-1
lines changed Expand file tree Collapse file tree 5 files changed +63
-1
lines changed Original file line number Diff line number Diff line change 1
1
Next version
2
2
------------
3
3
4
- - ...
4
+ - Avoid mutations in attribute parameters # 29
5
5
6
6
0.2
7
7
---
Original file line number Diff line number Diff line change 36
36
(ocaml-compiler-libs (>= v0.12.0))
37
37
(ppx_derivers (>= 1.2.1))
38
38
(yojson (>= 2.0.0))
39
+ (ppx_deriving :with-test)
39
40
(ounit2 :with-test)))
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ depends: [
28
28
"ocaml-compiler-libs" {>= "v0.12.0"}
29
29
"ppx_derivers" {>= "1.2.1"}
30
30
"yojson" {>= "2.0.0"}
31
+ "ppx_deriving" {with-test}
31
32
"ounit2" {with-test}
32
33
"odoc" {with-doc}
33
34
]
Original file line number Diff line number Diff line change @@ -488,6 +488,8 @@ class mutate_mapper (rs : RS.t) =
488
488
| _ ->
489
489
super#expression ctx e
490
490
491
+ (* don't mutate attribute parameters such as 'false' in [@@deriving show {with_path=false}] *)
492
+ method! attributes _ctx attrs = return attrs
491
493
492
494
method transform_impl_file ctx impl_ast =
493
495
let input_name = Base_exp_context. input_name ctx in
Original file line number Diff line number Diff line change
1
+ Let us try something:
2
+
3
+ $ ls .. / filter_dune_build. sh
4
+ .. / filter_dune_build. sh
5
+
6
+ Create a file with a deriving show attribute https: // github. com/ jmid/ mutaml/ issues/ 28
7
+ $ cat > test. ml << EOF
8
+ > type some_type = A | B [@@ deriving show {with_path = false}]
9
+ > type another_type = C | D of some_type [@@ deriving show {with_path = false}]
10
+ > ;;
11
+ > assert (show_another_type C = " C" )
12
+ > EOF
13
+
14
+ Create the dune files:
15
+ $ cat > dune-project << EOF
16
+ > (lang dune 2.9 )
17
+ > EOF
18
+
19
+ $ cat > dune << ' EOF'
20
+ > (executable
21
+ > (name test)
22
+ > (preprocess (pps ppx_deriving. show))
23
+ > (instrumentation (backend mutaml))
24
+ > )
25
+ > EOF
26
+
27
+ Check that files were created as expected:
28
+ $ ls dune* test. ml
29
+ dune
30
+ dune-project
31
+ test. ml
32
+
33
+ Set seed and (full) mutation rate as environment variables , for repeatability
34
+ $ export MUTAML_SEED= 896745231
35
+ $ export MUTAML_MUT_RATE= 100
36
+
37
+ $ .. / filter_dune_build. sh ./ test. exe -- instrument-with mutaml
38
+ Running mutaml instrumentation on " test.ml"
39
+ Randomness seed: 896745231 Mutation rate: 100 GADTs enabled: true
40
+ Created 0 mutations of test. ml
41
+ Writing mutation info to test. muts
42
+
43
+ $ ls _build
44
+ default
45
+ log
46
+
47
+ $ ls _build/ default
48
+ mutaml-mut-files. txt
49
+ test. exe
50
+ test. ml
51
+ test. muts
52
+ test. pp. ml
53
+
54
+ $ mutaml-runner _build/ default / test. exe
55
+ read mut file test. muts
56
+ Warning: No mutations were listed in test. muts
57
+ Did not find any mutations across the files listed in mutaml-mut-files. txt
58
+ [1 ]
You can’t perform that action at this time.
0 commit comments