Skip to content

Commit c1c61c6

Browse files
authored
chore: enable doctests (#181)
1 parent 7e7ec7f commit c1c61c6

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,8 @@ jobs:
4646
- name: Run core tests
4747
run: nix-shell --run "cabal test core"
4848

49+
- name: Run core doctests
50+
run: nix-shell --run "run-doctests-verbose"
51+
4952
- name: Run CLI tests
5053
run: nix-shell --run "cabal test cli"

core/core/Array.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ unwrap (Array v) = v
9494

9595
-- | Return an empty array.
9696
--
97-
-- > length empty == 0
97+
-- >>> empty :: Array Int
98+
-- Array []
9899
empty :: Array a
99100
empty =
100101
Array Data.Vector.empty

shell.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ in pkgs.mkShell rec {
2222
pkgs.hlint
2323
pkgs.haskellPackages.zlib
2424
pkgs.haskellPackages.hspec-discover
25+
pkgs.haskellPackages.doctest
2526

2627
# Nix dev tools
2728
pkgs.nil
@@ -36,6 +37,14 @@ in pkgs.mkShell rec {
3637
shellHook = ''
3738
unset TEMP TMP TEMPDIR TMPDIR # Required for nix-shell to work
3839
${pre-commit.pre-commit-check.shellHook}
40+
41+
run-doctests-verbose() {
42+
cabal repl --with-compiler=doctest --repl-options=--verbose core
43+
}
44+
45+
run-doctests() {
46+
cabal repl --with-compiler=doctest core
47+
}
3948
'';
4049

4150
# Required for cabal to find the location of zlib and other native libraries

0 commit comments

Comments
 (0)