Skip to content

Commit

Permalink
add a test case for reading library names from a dune package
Browse files Browse the repository at this point in the history
  • Loading branch information
sabine committed Jan 14, 2024
1 parent 9d77670 commit 5ae9d11
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 0 deletions.
78 changes: 78 additions & 0 deletions test/can-read-library-names.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
Install the package

$ PKG=can-read-library-names
$ opam install packages/$PKG --yes > /dev/null

Generate the can-read-library-names documentation

$ voodoo-prep
Warning: No universes have been specified: will generate dummy universes

$ voodoo-do -p $PKG -b 2> /dev/null

$ voodoo-gen -o output
0 other versions, 1 packages
Found 5 files

Generates a package.json file with the library names
$ cat output/p/$PKG/1.0/package.json | jq .
{
"libraries": [
{
"name": "can-read-library-names.singleton",
"modules": [
{
"name": "Singleton",
"submodules": [],
"kind": "module"
}
],
"dependencies": []
},
{
"name": "can-read-library-names.unwrapped",
"modules": [
{
"name": "Unwrapped_module2",
"submodules": [],
"kind": "module"
},
{
"name": "Unwrapped_module1",
"submodules": [],
"kind": "module"
}
],
"dependencies": []
},
{
"name": "can-read-library-names.wrapped",
"modules": [
{
"name": "Wrapped",
"submodules": [
{
"name": "Wrapped_module2",
"submodules": [],
"kind": "module"
},
{
"name": "Wrapped_module1",
"submodules": [],
"kind": "module"
}
],
"kind": "module"
}
],
"dependencies": []
}
]
}

Converted the README.org file in HTML
$ cat output/p/$PKG/1.0/README.org.html.json | jq '.content'
cat: output/p/can-read-library-names/1.0/README.org.html.json: No such file or directory

Uninstall the package
$ opam remove $PKG --yes > /dev/null
27 changes: 27 additions & 0 deletions test/packages/can-read-library-names/can-read-library-names.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
opam-version: "2.0"
name: "can-read-library-names"
version: "1.0"
synopsis: "Test"
description: "Test"
maintainer: ["me"]
authors: ["me"]
homepage: "http://github.com"
bug-reports: "http://github.com"
depends: [
"dune"
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
2 changes: 2 additions & 0 deletions test/packages/can-read-library-names/dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(lang dune 3.12)
(name can-read-library-names)
3 changes: 3 additions & 0 deletions test/packages/can-read-library-names/lib/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(library
(name wrapped)
(public_name can-read-library-names.wrapped))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let x = "hello"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let x = "hello"
3 changes: 3 additions & 0 deletions test/packages/can-read-library-names/lib2/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(library
(name singleton)
(public_name can-read-library-names.singleton))
1 change: 1 addition & 0 deletions test/packages/can-read-library-names/lib2/singleton.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let x = "hello"
4 changes: 4 additions & 0 deletions test/packages/can-read-library-names/lib3/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(library
(name unwrapped)
(wrapped false)
(public_name can-read-library-names.unwrapped))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let y = "hello"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let y = "hello"
2 changes: 2 additions & 0 deletions test/packages/can-read-library-names/test/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(test
(name test_test_project))
Empty file.

0 comments on commit 5ae9d11

Please sign in to comment.