Skip to content

Commit f0d3ed5

Browse files
committed
Improve coverage
Signed-off-by: Kakadu <Kakadu@pm.me>
1 parent d02495b commit f0d3ed5

7 files changed

Lines changed: 58 additions & 64 deletions

File tree

config/discover.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,14 @@ let gen_tests_dune dir =
195195
Format.fprintf ppf "@[(preprocessor_deps (file %s))@]@," pp
196196
in
197197
let ppx_rewriter ppf () =
198-
let pp = "%{project_root}/ppx/pp_gt.exe" in
198+
(* let pp = "%{project_root}/ppx/pp_gt.exe" in *)
199199
(* --as-pp will output serialized AST
200200
without it the human-readable AST will be printed
201201
***)
202-
(* Format.fprintf ppf "@[(instrumentation (backend bisect_ppx))@]"; *)
203-
(* Format.fprintf ppf "@[(preprocess (pps GT.ppx_all))@]"; *)
204-
Format.fprintf ppf "@[(preprocess (action (run %s --as-pp %%{input-file})))@]@," pp;
205-
Format.fprintf ppf "@[(preprocessor_deps (file %s))@]@," pp
202+
Format.fprintf ppf "@[(instrumentation (backend bisect_ppx))@]";
203+
Format.fprintf ppf "@[(preprocess (pps GT.ppx_all))@]";
204+
(* Format.fprintf ppf "@[(preprocess (action (run %s --as-pp %%{input-file})))@]@," pp; *)
205+
(* Format.fprintf ppf "@[(preprocessor_deps (file %s))@]@," pp *)
206206
in
207207
let () = wrap "camlp5" (camlp5_tests dir) p5_rewriter in
208208
let () = wrap ~flags:"-rectypes" "camlp5+rectypes" camlp5_rectypes_tests p5_rewriter in

config/dune

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
(env
2+
(_
3+
(flags
4+
(:standard -warn-error -26))))
5+
16
(executable
27
(name discover)
38
(modules Discover)

ppx/pp_gt.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
(* TODO: make -pretty option to be a default *)
2-
31
(*
42
* Generic Transformers PPX syntax extension.
53
* Copyright (C) 2016-2019
64
* Dmitrii Kosarev aka Kakadu
75
* St.Petersburg State University, JetBrains Research
86
*)
97

8+
[@@@coverage off]
9+
10+
(* TODO: make -pretty option to be a default *)
11+
1012
let () = Ppxlib.Driver.standalone ()

regression/dune.tests

Lines changed: 29 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,7 @@
489489
(name test800)
490490
(modules test800)
491491
(libraries GT)
492-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
493-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
492+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
494493

495494
(cram
496495
(applies_to test802)
@@ -499,8 +498,7 @@
499498
(name test802mutal)
500499
(modules test802mutal)
501500
(libraries GT)
502-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
503-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
501+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
504502

505503
(cram
506504
(applies_to test803)
@@ -509,8 +507,7 @@
509507
(name test803polyvar)
510508
(modules test803polyvar)
511509
(libraries GT)
512-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
513-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
510+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
514511

515512
(cram
516513
(applies_to test804)
@@ -519,8 +516,7 @@
519516
(name test804polyvar)
520517
(modules test804polyvar)
521518
(libraries GT)
522-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
523-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
519+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
524520

525521
(cram
526522
(applies_to test805)
@@ -529,8 +525,7 @@
529525
(name test805std)
530526
(modules test805std)
531527
(libraries GT)
532-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
533-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
528+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
534529

535530
(cram
536531
(applies_to test806)
@@ -539,8 +534,7 @@
539534
(name test806fmt)
540535
(modules test806fmt)
541536
(libraries GT)
542-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
543-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
537+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
544538

545539
(cram
546540
(applies_to test807)
@@ -549,8 +543,7 @@
549543
(name test807showT)
550544
(modules test807showT)
551545
(libraries GT)
552-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
553-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
546+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
554547

555548
(cram
556549
(applies_to test811)
@@ -559,8 +552,7 @@
559552
(name test811compare)
560553
(modules test811compare)
561554
(libraries GT)
562-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
563-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
555+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
564556

565557
(cram
566558
(applies_to test812)
@@ -569,8 +561,7 @@
569561
(name test812html)
570562
(modules test812html)
571563
(libraries GT)
572-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
573-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
564+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
574565

575566
(cram
576567
(applies_to test813)
@@ -579,8 +570,7 @@
579570
(name test813htmlTy)
580571
(modules test813htmlTy)
581572
(libraries GT)
582-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
583-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
573+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
584574

585575
(cram
586576
(applies_to test815)
@@ -589,8 +579,7 @@
589579
(name test815abstr)
590580
(modules test815abstr)
591581
(libraries GT)
592-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
593-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
582+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
594583

595584
(cram
596585
(applies_to test816)
@@ -599,8 +588,7 @@
599588
(name test816hash)
600589
(modules test816hash)
601590
(libraries GT)
602-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
603-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
591+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
604592

605593
(cram
606594
(applies_to test820)
@@ -609,8 +597,7 @@
609597
(name test820spec)
610598
(modules test820spec)
611599
(libraries GT)
612-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
613-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
600+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
614601

615602
(cram
616603
(applies_to test821)
@@ -619,8 +606,7 @@
619606
(name test821clab)
620607
(modules test821clab)
621608
(libraries GT)
622-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
623-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
609+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
624610

625611
(cram
626612
(applies_to test822)
@@ -629,8 +615,7 @@
629615
(name test822)
630616
(modules test822)
631617
(libraries GT)
632-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
633-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
618+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
634619

635620
(cram
636621
(applies_to test823)
@@ -639,8 +624,7 @@
639624
(name test823list)
640625
(modules test823list)
641626
(libraries GT)
642-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
643-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
627+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
644628

645629
(cram
646630
(applies_to test824)
@@ -649,8 +633,7 @@
649633
(name test824mut)
650634
(modules test824mut)
651635
(libraries GT)
652-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
653-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
636+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
654637

655638
(cram
656639
(applies_to test825)
@@ -659,8 +642,7 @@
659642
(name test825tuples)
660643
(modules test825tuples)
661644
(libraries GT)
662-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
663-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
645+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
664646

665647
(cram
666648
(applies_to test826)
@@ -669,8 +651,7 @@
669651
(name test826antiph)
670652
(modules test826antiph)
671653
(libraries GT)
672-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
673-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
654+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
674655

675656
(cram
676657
(applies_to test827)
@@ -679,8 +660,7 @@
679660
(name test827mut)
680661
(modules test827mut)
681662
(libraries GT)
682-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
683-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
663+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
684664

685665
(cram
686666
(applies_to test828)
@@ -689,8 +669,7 @@
689669
(name test828combi)
690670
(modules test828combi)
691671
(libraries GT)
692-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
693-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
672+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
694673

695674
(cram
696675
(applies_to test829)
@@ -699,8 +678,7 @@
699678
(name test829enum)
700679
(modules test829enum)
701680
(libraries GT)
702-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
703-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
681+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
704682

705683
(cram
706684
(applies_to test840)
@@ -709,8 +687,7 @@
709687
(name test840garrique)
710688
(modules test840garrique)
711689
(libraries GT)
712-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
713-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
690+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
714691
; ppx+rectypes
715692

716693
(cram
@@ -721,8 +698,7 @@
721698
(modules test798gen)
722699
(flags (:standard -rectypes))
723700
(libraries GT)
724-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
725-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
701+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
726702

727703
(cram
728704
(applies_to test817)
@@ -732,8 +708,7 @@
732708
(modules test817logic)
733709
(flags (:standard -rectypes))
734710
(libraries GT)
735-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
736-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
711+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
737712

738713
(cram
739714
(applies_to test827)
@@ -743,8 +718,7 @@
743718
(modules test827)
744719
(flags (:standard -rectypes))
745720
(libraries GT)
746-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
747-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
721+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
748722

749723
(cram
750724
(applies_to test828)
@@ -753,9 +727,8 @@
753727
(name test828mut)
754728
(modules test828mut)
755729
(flags (:standard -rectypes))
756-
(libraries GT)
757-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
758-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
730+
(libraries GT bisect_ppx.runtime)
731+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))
759732

760733
(cram
761734
(applies_to test830)
@@ -765,5 +738,4 @@
765738
(modules test830mut)
766739
(flags (:standard -rectypes))
767740
(libraries GT)
768-
(preprocess (action (run %{project_root}/ppx/pp_gt.exe --as-pp %{input-file})))
769-
(preprocessor_deps (file %{project_root}/ppx/pp_gt.exe)))
741+
(instrumentation (backend bisect_ppx))(preprocess (pps GT.ppx_all)))

regression/test829enum.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ let () = Format.printf "%d %d %d\n%!" (GT.enum u `A) (GT.enum u `B) (GT.enum u (
1111
type arr = GT.int GT.array [@@deriving gt ~options:{enum}]
1212

1313
type list = (GT.int -> GT.int) GT.list [@@deriving gt ~options:{enum}]
14+
15+
type rec1 = { rec1_f1: int } [@@deriving gt ~options:{enum}]
16+
let __ { rec1_f1 }= { rec1_f1 = 23 + rec1_f1 }
17+
18+
[@@@ocaml.warning "-27"]
19+
20+
type 'a alg_constr = Constr1 of { count: 'a } [@@deriving gt ~options:{enum}]
21+
22+
let __ = Constr1 { count = 23. }

regression/test840.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
2
44
17
55
2
6+
(\_3 -> (x + 1))

regression/test840garrique.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ module A = struct
199199
(* (fun y -> x+y)x when x = 1 *)
200200
Printf.printf "%s\n" @@ to_string @@
201201
recursive_eval ["x", `Num 1] (`App (`Abs ("y", `Add (`Var "x", `Var "y")), `Var "x") );
202+
203+
(* (fun y -> x+1) *)
204+
Printf.printf "%s\n" @@ to_string @@
205+
recursive_eval [] (`Abs ("y", `Add (`Var "x", `Num 1)));
206+
202207
()
203208

204209
end

0 commit comments

Comments
 (0)