Skip to content

A peer-to-peer stack for code collaboration

Doctests now live in radicle-lang. Updated cloudbuild file to run all test suites

Fintan Halpennya1e22fff3bd4
diff --git a/cloudbuild.yaml b/cloudbuild.yaml
index b146fd5..87aad26 100644
--- a/cloudbuild.yaml
+++ b/cloudbuild.yaml
@@ -99,8 +99,10 @@ steps:
- |
set -euxo pipefail
- stack test :doctest
- stack test :spec
+ stack test radicle-lang:doctest
+ stack test radicle-lang:spec
+ stack test radicle-repl:spec
+ stack test radicle:spec
RADPATH="$(pwd)/rad" stack exec -- radicle test/all.rad
- id: "Lint (weeder)"
diff --git a/package.yaml b/package.yaml
index 53a81fe..5ffa2b3 100644
--- a/package.yaml
+++ b/package.yaml
@@ -88,15 +88,6 @@ tests:
build-tools:
- tasty-discover
ghc-options: [-threaded, -rtsopts, -with-rtsopts=-N]
- doctest:
- main: Main.hs
- source-dirs:
- - test/docs
- dependencies:
- - doctest
- - Glob
- - hpack
- ghc-options: [-threaded, -rtsopts, -with-rtsopts=-N]
e2e:
main: Main.hs
source-dirs:
diff --git a/radicle-lang/package.yaml b/radicle-lang/package.yaml
index 2fab50c..e9497e0 100644
--- a/radicle-lang/package.yaml
+++ b/radicle-lang/package.yaml
@@ -62,6 +62,17 @@ tests:
- tasty-discover
ghc-options: [-threaded, -rtsopts, -with-rtsopts=-N]
+ doctest:
+ main: Main.hs
+ source-dirs:
+ - test/docs
+ dependencies:
+ - doctest
+ - Glob
+ - hpack
+ - protolude
+ ghc-options: [-threaded, -rtsopts, -with-rtsopts=-N]
+
default-extensions:
- ConstraintKinds
- DefaultSignatures
diff --git a/radicle-lang/radicle-lang.cabal b/radicle-lang/radicle-lang.cabal
index df64c3a..711b39b 100644
--- a/radicle-lang/radicle-lang.cabal
+++ b/radicle-lang/radicle-lang.cabal
@@ -2,7 +2,7 @@
--
-- see: https://github.com/sol/hpack
--
--- hash: d2ab9b80c726e88c408a7ca5bbf94e901f76a12cf13c294175e6368e4b89793d
+-- hash: 0516796b244f09e82d00bb3cfe9fd78f7d103f340aa50ed3c90901dc053ea598
name: radicle-lang
version: 0.0.1
@@ -71,6 +71,23 @@ library
, vector
default-language: Haskell2010
+test-suite doctest
+ type: exitcode-stdio-1.0
+ main-is: Main.hs
+ other-modules:
+ Paths_radicle_lang
+ hs-source-dirs:
+ test/docs
+ default-extensions: ConstraintKinds DefaultSignatures DeriveDataTypeable DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GeneralizedNewtypeDeriving LambdaCase MultiParamTypeClasses NoImplicitPrelude OverloadedStrings RankNTypes RecordWildCards ScopedTypeVariables StandaloneDeriving TupleSections TypeFamilies
+ ghc-options: -threaded -rtsopts -with-rtsopts=-N
+ build-depends:
+ Glob
+ , base >=4.7 && <5
+ , doctest
+ , hpack
+ , protolude
+ default-language: Haskell2010
+
test-suite spec
type: exitcode-stdio-1.0
main-is: Main.hs
diff --git a/radicle-lang/test/docs/Main.hs b/radicle-lang/test/docs/Main.hs
new file mode 100644
index 0000000..582c921
--- /dev/null
+++ b/radicle-lang/test/docs/Main.hs
@@ -0,0 +1,16 @@
+module Main (main) where
+
+import Protolude
+
+import Hpack.Config
+import System.FilePath.Glob (glob)
+import Test.DocTest
+
+main :: IO ()
+main = do
+ Right pkg <- fmap decodeResultPackage <$> readPackageConfig defaultDecodeOptions
+ exts <- case sectionDefaultExtensions <$> packageLibrary pkg of
+ Just es -> pure es
+ Nothing -> die "No default-extensions in package.yaml"
+ srcs <- glob "src/**/*.hs"
+ doctest $ srcs ++ fmap ("-X" ++) exts