package ppx_inline_test

  1. Overview
  2. Docs
Syntax extension for writing in-line tests in ocaml code

Install

Dune Dependency

Authors

Maintainers

Sources

v0.15.1.tar.gz
md5=91d1cf7489d35864381d9a435b46bb64
sha512=27dd4a4b9f0e8f7b22a7de4016ab0b8733e1ad4fe9e9e19cd98d321c071dd8662830a4e83579a2595d53b0a47c2ba03c1165df95312d6effc46c8aa13c0324b6

doc/src/ppx_inline_test.libname/ppx_inline_test_libname.ml.html

Source file ppx_inline_test_libname.ml

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
open Ppxlib

let libname = ref None

let () =
  Driver.add_arg "-inline-test-lib" (Arg.String (fun s -> libname := Some s))
    ~doc:" A base name to use for generated identifiers \
          (has to be globally unique in a program).\
          ppx_inline_test (and ppx_bench) are disabled unless this flag is passed.";
;;

let () =
  Driver.Cookies.add_simple_handler "library-name" Ast_pattern.(estring __)
    ~f:(function
      | None -> ()
      | Some lib -> libname := Some lib)
;;

let get () =
  match !libname with
  | None -> None
  | Some lib ->
    match String.index lib ':' with
    | exception Not_found -> Some (lib, "")
    | i -> Some (String.sub lib 0 i, String.sub lib (i + 1) (String.length lib - i - 1))
OCaml

Innovation. Community. Security.