Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable cram by default starting with 3.0 #4262

Merged
merged 1 commit into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ Unreleased
- `dune ocaml-merlin` is now able to provide configuration for source files in
the `_build` directory. (#4274, @voodoos)

- Enable cram tests by default (#4262, @rgrinberg)

2.8.2 (21/01/2021)
------------------

Expand Down
1 change: 1 addition & 0 deletions doc/test/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ is fine, but you then need to update the list of such exceptions below.
../formatting.rst:.. note:: This section applies only to projects with ``(lang dune 1.x)``.
../formatting.rst:In ``(lang dune 1.x)``, no formatting is done by default. This feature is
../formatting.rst:(lang dune 2.0)
../tests.rst: (lang dune 2.7)
6 changes: 3 additions & 3 deletions doc/tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -474,12 +474,12 @@ Cram Tests

Cram tests are expectation tests written in a shell-like syntax. They are ideal
for testing binaries. Cram tests are auto discovered from files or directories
with a ``.t`` extension, so they must be enabled manually in the
``dune-project`` file:
with a ``.t`` extension. This is automatically enabled starting from 3.0, for
older versions, this must be manually enabled in the ``dune-project`` file:

.. code:: scheme

(lang dune 3.0)
(lang dune 2.7)
(cram enable)


Expand Down
7 changes: 5 additions & 2 deletions src/dune_engine/dune_project.ml
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ let strict_package_deps_default ~(lang : Lang.Instance.t) =

let explicit_js_mode_default ~(lang : Lang.Instance.t) = lang.version >= (2, 0)

let cram_default ~(lang : Lang.Instance.t) = lang.version >= (3, 0)

let format_extension_key =
Extension.register Format_config.syntax Format_config.dparse_args
Format_config.to_dyn
Expand Down Expand Up @@ -480,6 +482,7 @@ let infer ~dir packages =
in
let explicit_js_mode = explicit_js_mode_default ~lang in
let strict_package_deps = strict_package_deps_default ~lang in
let cram = cram_default ~lang in
let root = dir in
let file_key = File_key.make ~root ~name in
{ name
Expand All @@ -506,7 +509,7 @@ let infer ~dir packages =
; explicit_js_mode
; format_config = None
; strict_package_deps
; cram = false
; cram
}

module Toggle = struct
Expand Down Expand Up @@ -720,7 +723,7 @@ let parse ~dir ~lang ~opam_packages ~file ~dir_status =
in
let cram =
match cram with
| None -> false
| None -> cram_default ~lang
| Some t -> Toggle.enabled t
in
let root = dir in
Expand Down