Skip to content

Commit c3b8b36

Browse files
committed
Add tests for Language.PureScript.Docs
In particular, tests for documentation for re-exports.
1 parent 2ed7800 commit c3b8b36

25 files changed

Lines changed: 441 additions & 4 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ tmp/
1616
.stack-work/
1717
tests/support/flattened/
1818
output
19+
examples/docs/docs/
20+
core-tests/full-core-docs.md

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ install:
5757
# Snapshot state of the sandbox now, so we don't need to make new one for test install
5858
- rm -rf ~/cabal-sandboxes/$GHCVER-${STACKAGE:-none}
5959
- cp -r .cabal-sandbox ~/cabal-sandboxes/$GHCVER-${STACKAGE:-none}
60+
# Install bower globally (for psc-docs/psc-publish tests)
61+
- npm install -g bower
6062
script:
6163
- ./travis/configure.sh
6264
- cabal build --ghc-options="-Werror"

core-tests/test-everything.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ if [ "$force_reinstall" = "true" ] && [ -d "bower_components" ]; then
1818
rm -r bower_components
1919
fi
2020

21-
npm install bower
22-
23-
node_modules/.bin/bower i \
21+
bower i \
2422
purescript-prelude \
2523
purescript-eff \
2624
purescript-st \
@@ -75,3 +73,7 @@ fi
7573
../dist/build/psc/psc tests/*/*.purs \
7674
'bower_components/purescript-*/src/**/*.purs' \
7775
--ffi 'bower_components/purescript-*/src/**/*.js'
76+
77+
../dist/build/psc-docs/psc-docs tests/*/*.purs \
78+
'bower_components/purescript-*/src/**/*.purs' \
79+
> full-core-docs.md

examples/docs/bower.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "docs-test-package",
3+
"version": "1.0.0",
4+
"moduleType": [
5+
"node"
6+
],
7+
"repository": {
8+
"type": "git",
9+
"url": "git://github.com/not-real/not-a-real-repo.git"
10+
},
11+
"ignore": [
12+
"**/.*",
13+
"node_modules",
14+
"bower_components",
15+
"output"
16+
],
17+
"dependencies": {
18+
}
19+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module Prelude where
2+
3+
newtype Unit = Unit {}
4+
5+
unit :: Unit
6+
unit = Unit {}
7+
8+
data Boolean2 = True | False

examples/docs/src/Clash.purs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module Clash (module Clash1) where
2+
3+
import Clash1 as Clash1
4+
import Clash2 as Clash2
5+
6+
module Clash1 (module Clash1a) where
7+
8+
import Clash1a
9+
10+
module Clash1a where
11+
12+
value :: Int
13+
value = 0
14+
15+
type Type = Int
16+
17+
class TypeClass a where
18+
typeClassMember :: a
19+
20+
module Clash2 (module Clash2a) where
21+
22+
import Clash2a
23+
24+
module Clash2a where
25+
26+
value :: String
27+
value = "hello"
28+
29+
type Type = String
30+
31+
class TypeClass a b where
32+
typeClassMember :: a -> b
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module DuplicateNames
2+
( module DuplicateNames
3+
, module Prelude
4+
) where
5+
6+
import Prelude (Unit)
7+
8+
unit :: Int
9+
unit = 0

examples/docs/src/Example.purs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module Example
2+
( module Prelude
3+
, module Example2
4+
) where
5+
6+
import Prelude (Unit())
7+
import Example2 (one)

examples/docs/src/Example2.purs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module Example2 where
2+
3+
one :: Int
4+
one = 1
5+
6+
two :: Int
7+
two = 2
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module MultiVirtual
2+
( module X )
3+
where
4+
5+
import MultiVirtual1 as X
6+
import MultiVirtual2 as X
7+
8+
9+
module MultiVirtual1 where
10+
11+
foo :: Int
12+
foo = 1
13+
14+
module MultiVirtual2
15+
( module MultiVirtual2
16+
, module MultiVirtual3
17+
) where
18+
19+
import MultiVirtual3
20+
21+
bar :: Int
22+
bar = 2
23+
24+
module MultiVirtual3 where
25+
26+
baz :: Int
27+
baz = 3

0 commit comments

Comments
 (0)