Module Test_helpers

Helpers for dunolint tests.

This module defines utils used by the tests of dunolint. It is not meant to be exported outside of the dunolint project, and thus is simply named "Test_helpers" rather than have a dunolint part in its name.

Parsing Fields

val read_sexp_field : path:Fpath_base.Fpath.t -> Base.string -> Sexps_rewriter.t * Base.Sexp.t
val parse : (module Dunolinter.Sexp_handler.S with type t = 'a) -> path:Fpath_base.Fpath.t -> Base.string -> (Sexps_rewriter.t * Base.Sexp.t) * 'a

Trilang

val is_true : Dunolint.Trilang.t -> Base.unit
val is_false : Dunolint.Trilang.t -> Base.unit
val is_undefined : Dunolint.Trilang.t -> Base.unit

Linting

val run_linter : config:Dunolint.Config.t -> Base.unit

A helper to run more or less the equivalent of the lint command, given a configuration. This runs the dunolint engine in dry-run mode, which would print diffs on the standard output. This is meant to be run from within a call to Err.For_test.protect, such as, for example:

  Err.For_test.protct (fun () -> Test_helpers.run_linter ~config);
  [%expect {||}]