File: gen_tests.ml

package info (click to toggle)
ocaml-cstruct 6.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 968 kB
  • sloc: ml: 3,676; ansic: 56; javascript: 21; makefile: 18
file content (31 lines) | stat: -rw-r--r-- 645 bytes parent folder | download | duplicates (2)
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
let output_stanzas name =
  Printf.printf
    {|
(rule
  (deps pp.exe (:input %s))
  (targets %s.errors)
  (action
    (progn
      (with-stderr-to %%{targets}
        (run ./pp.exe -no-color --impl %%{input}))
      (bash "sed -i.bak '1d' %%{targets}"))))
(rule
  (alias runtest)
  (package ppx_cstruct)
  (action
    (diff %s.expected %s.errors)))
|}
    name name name name

let is_test = function
  | "pp.ml" -> false
  | "pp.pp.ml" -> false
  | "gen_tests.ml" -> false
  | e -> Filename.check_suffix e ".ml"

let () =
  Sys.readdir "."
  |> Array.to_list
  |> List.sort String.compare
  |> List.filter is_test
  |> List.iter output_stanzas