proper cram test with coverage

This commit is contained in:
zapashcanon 2023-06-03 14:59:51 +02:00
parent b2499acf4e
commit bd115a6c80
Signed by: zapashcanon
GPG Key ID: 8981C3C62D1D28F1
13 changed files with 106 additions and 4 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
_build
_coverage
*.coverage

View File

@ -1,4 +1,48 @@
(lang dune 3.0)
(using menhir 2.1)
(using mdx 0.2)
(cram enable)
(name flambda)
(license ISC)
(authors
"Léo Andrès <contact@ndrs.fr>")
(maintainers "Léo Andrès <contact@ndrs.fr>")
(source
(uri git+https://git.zapashcanon.fr/zapashcanon/paper-wasocaml.git))
(homepage https://git.zapashcanon.fr/zapashcanon/paper-wasocaml)
(bug_reports https://git.zapashcanon.fr/zapashcanon/paper-wasocaml/issues)
(documentation https://doc.zapashcanon.fr/paper-wasocaml)
(generate_opam_files true)
(package
(name flambda)
(synopsis
"Mini flambda")
(description
"Mini Flambda")
(tags
(ocaml webassembly wasm interpreter flambda))
(depends
(ocaml
(>= 4.13))
sedlex
(menhir
(and
:build
(>= 20220210)))
(bisect_ppx
(and
:with-test
(>= "2.5")
:dev))
(odoc :with-doc)))

34
flambda.opam Normal file
View File

@ -0,0 +1,34 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Mini flambda"
description: "Mini Flambda"
maintainer: ["Léo Andrès <contact@ndrs.fr>"]
authors: ["Léo Andrès <contact@ndrs.fr>"]
license: "ISC"
tags: ["ocaml" "webassembly" "wasm" "interpreter" "flambda"]
homepage: "https://git.zapashcanon.fr/zapashcanon/paper-wasocaml"
doc: "https://doc.zapashcanon.fr/paper-wasocaml"
bug-reports: "https://git.zapashcanon.fr/zapashcanon/paper-wasocaml/issues"
depends: [
"dune" {>= "3.0"}
"ocaml" {>= "4.13"}
"sedlex"
"menhir" {build & >= "20220210"}
"bisect_ppx" {with-test & >= "2.5" & dev}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://git.zapashcanon.fr/zapashcanon/paper-wasocaml.git"

2
src/bisect.exclude Normal file
View File

@ -0,0 +1,2 @@
file "src/menhir_parser.ml"
file "src/lexer.ml"

View File

@ -29,8 +29,8 @@
(run texfot xelatex -halt-on-error -shell-escape main.tex)))
(executable
(name main)
(modules main)
(public_name flambda)
(modules flambda)
(libraries wasocaml_core))
(library
@ -39,7 +39,10 @@
(private_modules menhir_parser lexer)
(libraries menhirLib sedlex)
(preprocess
(pps sedlex.ppx)))
(pps sedlex.ppx))
(instrumentation
(backend bisect_ppx --exclusions src/bisect.exclude)
(deps bisect.exclude)))
(menhir
(modules menhir_parser))

4
test/cram/a.t Normal file
View File

@ -0,0 +1,4 @@
a.flambda1:
$ dune exec -- flambda a.flambda1
42
value 42

5
test/cram/b.t Normal file
View File

@ -0,0 +1,5 @@
b.flambda1:
$ dune exec -- flambda b.flambda1
unhandled exception dumb_exn
Fatal error: exception File "src/interpret.ml", line 239, characters 4-10: Assertion failed
[2]

6
test/cram/c.t Normal file
View File

@ -0,0 +1,6 @@
c.flambda1:
$ dune exec -- flambda c.flambda1
42
42
42
value 42

2
test/cram/dune Normal file
View File

@ -0,0 +1,2 @@
(cram
(deps %{bin:flambda} a.flambda1 b.flambda1 c.flambda1))