forked from gbury/dolmen
dolmen HACKING.md
9.4 kB · 218 lines
Markdown

# Hacking on Dolmen This file is incomplete, but may have interesting tips if you want to start hacking on dolmen. If you're having troubles, don't hesitate to contact me directly, ^^ ## Menhir version Some tests may depend on specifi versions of menhir. Notably the syntax error messages files can have slight changes between menhir versions (harmless changes, but they still induce a diff on the .messages files). Therefore to ensure that all tests succeed, users are encouraged to use the following version of menhir: ``` opam install menhir.20260209 ``` ## Build locally You need to have [ocaml](https://ocaml.org/) installed to compile dolmen. Additionally, some ocaml dependencies are needed. The easiest way to get a working ocaml installation, and install the dependencies is to use [opam](https://opam.ocaml.org/). See [this page](https://opam.ocaml.org/doc/Install.html#Using-your-distribution-39-s-package-system) for information about how to install opam on your system. Once you have opam installed, you can use the following commands to isntall the needed dependencies to build dolmen: ``` opam pin add -n . opam install --deps-only . ``` You can then build the project with ``` make ``` ## Tests Most tests are setup through dune files, associated with tune "runtest" alias. To run the tests: ``` make test ``` To promote the results of tests (if e.g. you have changed some error message, or added new tests): ``` make promote ``` ### Unit tests There a few (though not that many), unit tests. These are basically to test internal functions of the library, in order to check internal assumptions that may otherwise not be easy to check with complete parsing/typing tests. Follow the example in `tests/unit/bitv/` to add more unit tests. ### Binary tests There are quite a lot of tests for parsing, typing and other features that make use of the `dolmen` binary to check the behaviour of the whole library. Some of these tests verify that some well-formed inputs are correctly parsed/typed, but most of the tests a…