Skip to content

Commit

Permalink
Driver: Add instructions to test the pkg_args values
Browse files Browse the repository at this point in the history
I could not make it run in cram tests: it has to be tested by hand.
  • Loading branch information
panglesd committed Sep 10, 2024
1 parent 00bb12a commit 8a05685
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/driver/test/pkg_args.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Unfortunately, this cram test does not work due to interaction with opam and the
sandboxing.

Here is how to test the "pkg_args" feature, **by hand**.

From the test_odoc_driver/ folder:

$ opam pin .

Have a look at the `test_odoc_driver/odoc-config.sexp` file to see how it looks

$ cat test_odoc_driver/odoc-config.sexp
(packages brr)
(libraries brr brr.poke)

From where you want (Most likely the root of the repo):

$ dune exec -- odoc_driver -p test_odoc_driver -p brr --link-grep page-yo
'odoc' 'link' '_odoc/test_odoc_driver/doc/page-yo.odoc' '-o' '_odoc/test_odoc_driver/doc/page-yo.odocl' '-I' '_odoc/test_odoc_driver/doc/' '-I' 'test_odoc_driver/lib/test_odoc_driver' '-P' 'brr:_odoc/brr/doc' '-P' 'test_odoc_driver:_odoc/test_odoc_driver/doc' '-L' 'brr.poke:_odoc/brr/lib/brr.poke' '-L' 'brr:_odoc/brr/lib/brr' '-L' 'test_odoc_driver:_odoc/test_odoc_driver/lib/test_odoc_driver' '--current-package' 'test_odoc_driver' '--enable-missing-root-warning'

You can also check the references in the `yo` page resolves, by visiting the
generated page!

You can change the `odoc-config.sexp`, `opam upgrade test_odoc_driver` and rerun
the driver to see how that affects the `-P` and `-L` values passed.
1 change: 1 addition & 0 deletions src/driver/test/pkg_args.t/test_odoc_driver/doc/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(documentation)
3 changes: 3 additions & 0 deletions src/driver/test/pkg_args.t/test_odoc_driver/doc/yo.mld
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{0 Hey}

Bli {!/brr/page-index} {!/brr.poke/Brr_poke}
3 changes: 3 additions & 0 deletions src/driver/test/pkg_args.t/test_odoc_driver/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(install
(files odoc-config.sexp)
(section doc))
26 changes: 26 additions & 0 deletions src/driver/test/pkg_args.t/test_odoc_driver/dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
(lang dune 3.16)

(name test_odoc_driver)

(generate_opam_files true)

(source
(github username/reponame))

(authors "Author Name")

(maintainers "Maintainer Name")

(license LICENSE)

(documentation https://url/to/documentation)

(package
(name test_odoc_driver)
(synopsis "A short synopsis")
(description "A longer description")
(depends ocaml dune)
(tags
(topics "to describe" your project)))

; See the complete stanza docs at https://dune.readthedocs.io/en/stable/reference/dune-project/index.html
3 changes: 3 additions & 0 deletions src/driver/test/pkg_args.t/test_odoc_driver/lib/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(library
(public_name test_odoc_driver)
(name test_odoc_driver))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let x = 1
2 changes: 2 additions & 0 deletions src/driver/test/pkg_args.t/test_odoc_driver/odoc-config.sexp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(packages brr)
(libraries brr brr.poke)
31 changes: 31 additions & 0 deletions src/driver/test/pkg_args.t/test_odoc_driver/test_odoc_driver.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "A short synopsis"
description: "A longer description"
maintainer: ["Maintainer Name"]
authors: ["Author Name"]
license: "LICENSE"
tags: ["topics" "to describe" "your" "project"]
homepage: "https://github.com/username/reponame"
doc: "https://url/to/documentation"
bug-reports: "https://github.com/username/reponame/issues"
depends: [
"ocaml"
"dune" {>= "3.16"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/username/reponame.git"

0 comments on commit 8a05685

Please sign in to comment.