summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorhdgarrood <>2019-04-07 23:15:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-04-07 23:15:00 (GMT)
commit6abf0b97f82d952273a42d25cf9af3ed3516de93 (patch)
treec06f002ac56f3e19e7768ed806f5f4cf668a6fb7 /tests
parent0217be29c9135a585d4b554ed7e84e45ce974bf9 (diff)
version 0.12.40.12.4
Diffstat (limited to 'tests')
-rw-r--r--tests/Language/PureScript/Ide/CompletionSpec.hs7
-rw-r--r--tests/Language/PureScript/Ide/FilterSpec.hs96
-rw-r--r--tests/Language/PureScript/Ide/ImportsSpec.hs11
-rw-r--r--tests/Language/PureScript/Ide/SourceFileSpec.hs6
-rw-r--r--tests/Language/PureScript/Ide/Test.hs6
-rw-r--r--tests/Main.hs7
-rw-r--r--tests/TestBundle.hs95
-rw-r--r--tests/TestCompiler.hs146
-rw-r--r--tests/TestDocs.hs14
-rw-r--r--tests/TestPrimDocs.hs54
-rw-r--r--tests/TestPscPublish.hs25
-rw-r--r--tests/TestUtils.hs158
-rw-r--r--tests/purs/bundle/PSasConstructor.purs11
-rw-r--r--tests/purs/failing/Superclasses2.purs3
-rw-r--r--tests/purs/publish/basic-example/bower.json13
-rw-r--r--tests/purs/publish/basic-example/resolutions-legacy.json640
-rw-r--r--tests/purs/publish/basic-example/resolutions.json17
-rw-r--r--tests/purs/publish/basic-example/src/Main.purs16
-rw-r--r--tests/support/package-lock.json16
-rw-r--r--tests/support/package.json2
-rw-r--r--tests/support/prelude-resolutions.json8
-rw-r--r--tests/support/pscide/src/CompletionSpecDocs.purs1
22 files changed, 1094 insertions, 258 deletions
diff --git a/tests/Language/PureScript/Ide/CompletionSpec.hs b/tests/Language/PureScript/Ide/CompletionSpec.hs
index c9a84cf..0a85fda 100644
--- a/tests/Language/PureScript/Ide/CompletionSpec.hs
+++ b/tests/Language/PureScript/Ide/CompletionSpec.hs
@@ -65,3 +65,10 @@ spec = describe "Applying completion options" $ do
, typ "withType"
]
result `shouldSatisfy` \res -> complDocumentation res == Just "Doc *123*\n"
+
+ it "gets docs on module declaration" $ do
+ ([_, (Right (CompletionResult [ result ]))], _) <- Test.inProject $
+ Test.runIde [ load ["CompletionSpecDocs"]
+ , typ "CompletionSpecDocs"
+ ]
+ result `shouldSatisfy` \res -> complDocumentation res == Just "Module Documentation\n"
diff --git a/tests/Language/PureScript/Ide/FilterSpec.hs b/tests/Language/PureScript/Ide/FilterSpec.hs
index ed0e376..84a0e50 100644
--- a/tests/Language/PureScript/Ide/FilterSpec.hs
+++ b/tests/Language/PureScript/Ide/FilterSpec.hs
@@ -3,7 +3,8 @@
module Language.PureScript.Ide.FilterSpec where
import Protolude
-import Data.List.NonEmpty
+import qualified Data.Map as Map
+import qualified Data.Set as Set
import Language.PureScript.Ide.Filter
import Language.PureScript.Ide.Filter.Declaration as D
import Language.PureScript.Ide.Types
@@ -24,23 +25,23 @@ moduleG = (P.moduleNameFromString "Module.G", [T.ideTypeClass "MyClass" P.kindTy
moduleH = (P.moduleNameFromString "Module.H", [T.ideValueOp "<$>" (P.Qualified Nothing (Left "")) 0 Nothing Nothing])
moduleI = (P.moduleNameFromString "Module.I", [T.ideTypeOp "~>" (P.Qualified Nothing "") 0 Nothing Nothing])
-modules :: [Module]
-modules = [moduleA, moduleB]
+modules :: ModuleMap [IdeDeclarationAnn]
+modules = Map.fromList [moduleA, moduleB]
runEq :: Text -> [Module]
-runEq s = applyFilters [equalityFilter s] modules
+runEq s = Map.toList (applyFilters [exactFilter s] modules)
runPrefix :: Text -> [Module]
-runPrefix s = applyFilters [prefixFilter s] modules
+runPrefix s = Map.toList $ applyFilters [prefixFilter s] modules
runModule :: [P.ModuleName] -> [Module]
-runModule ms = applyFilters [moduleFilter ms] modules
+runModule ms = Map.toList $ applyFilters [moduleFilter (Set.fromList ms)] modules
-runNamespace :: NonEmpty IdeNamespace -> [Module] -> [Module]
-runNamespace namespaces = applyFilters [namespaceFilter namespaces]
+runNamespace :: Set IdeNamespace -> [Module] -> [Module]
+runNamespace namespaces = Map.toList . applyFilters [namespaceFilter namespaces] . Map.fromList
-runDeclaration :: [D.IdeDeclaration] -> [Module] -> [Module]
-runDeclaration decls = applyFilters [declarationTypeFilter decls]
+runDeclaration :: [D.DeclarationType] -> [Module] -> [Module]
+runDeclaration decls = Map.toList . applyFilters [declarationTypeFilter (Set.fromList decls)] . Map.fromList
spec :: Spec
spec = do
@@ -53,7 +54,7 @@ spec = do
runEq "data1" `shouldBe` [moduleB]
describe "prefixFilter" $ do
it "keeps everything on empty string" $
- runPrefix "" `shouldBe` modules
+ runPrefix "" `shouldBe` Map.toList modules
it "keeps functionname prefix matches" $
runPrefix "fun" `shouldBe` [moduleA]
it "keeps data decls prefix matches" $
@@ -67,102 +68,91 @@ spec = do
runModule (P.moduleNameFromString <$> ["Module.A", "Unknown"]) `shouldBe` [moduleA]
describe "namespaceFilter" $ do
it "extracts modules by filtering `value` namespaces" $
- runNamespace (fromList [IdeNSValue])
+ runNamespace (Set.fromList [IdeNSValue])
[moduleA, moduleB, moduleD] `shouldBe` [moduleA, moduleB]
it "extracts no modules by filtering `value` namespaces" $
- runNamespace (fromList [IdeNSValue])
+ runNamespace (Set.fromList [IdeNSValue])
[moduleD] `shouldBe` []
it "extracts modules by filtering `type` namespaces" $
- runNamespace (fromList [IdeNSType])
+ runNamespace (Set.fromList [IdeNSType])
[moduleA, moduleB, moduleC] `shouldBe` [moduleC]
it "extracts no modules by filtering `type` namespaces" $
- runNamespace (fromList [IdeNSType])
+ runNamespace (Set.fromList [IdeNSType])
[moduleA, moduleB] `shouldBe` []
it "extracts modules by filtering `kind` namespaces" $
- runNamespace (fromList [IdeNSKind])
+ runNamespace (Set.fromList [IdeNSKind])
[moduleA, moduleB, moduleD] `shouldBe` [moduleD]
it "extracts no modules by filtering `kind` namespaces" $
- runNamespace (fromList [IdeNSKind])
+ runNamespace (Set.fromList [IdeNSKind])
[moduleA, moduleB] `shouldBe` []
it "extracts modules by filtering `value` and `type` namespaces" $
- runNamespace (fromList [ IdeNSValue, IdeNSType])
+ runNamespace (Set.fromList [ IdeNSValue, IdeNSType])
[moduleA, moduleB, moduleC, moduleD]
`shouldBe` [moduleA, moduleB, moduleC]
it "extracts modules by filtering `value` and `kind` namespaces" $
- runNamespace (fromList [ IdeNSValue, IdeNSKind])
+ runNamespace (Set.fromList [ IdeNSValue, IdeNSKind])
[moduleA, moduleB, moduleC, moduleD]
`shouldBe` [moduleA, moduleB, moduleD]
it "extracts modules by filtering `type` and `kind` namespaces" $
- runNamespace (fromList [ IdeNSType, IdeNSKind])
+ runNamespace (Set.fromList [ IdeNSType, IdeNSKind])
[moduleA, moduleB, moduleC, moduleD]
`shouldBe` [moduleC, moduleD]
it "extracts modules by filtering `value`, `type` and `kind` namespaces" $
- runNamespace (fromList [ IdeNSValue, IdeNSType, IdeNSKind])
+ runNamespace (Set.fromList [ IdeNSValue, IdeNSType, IdeNSKind])
[moduleA, moduleB, moduleC, moduleD]
`shouldBe` [moduleA, moduleB, moduleC, moduleD]
describe "declarationTypeFilter" $ do
- let moduleADecl = D.IdeDeclaration D.Value
- moduleCDecl = D.IdeDeclaration D.Type
- moduleDDecl = D.IdeDeclaration D.Kind
- moduleEDecl = D.IdeDeclaration D.Synonym
- moduleFDecl = D.IdeDeclaration D.DataConstructor
- moduleGDecl = D.IdeDeclaration D.TypeClass
- moduleHDecl = D.IdeDeclaration D.ValueOperator
- moduleIDecl = D.IdeDeclaration D.TypeOperator
- it "keeps everything on empty list of declarations" $
- runDeclaration []
- [moduleA, moduleB, moduleD] `shouldBe` [moduleA, moduleB, moduleD]
it "extracts modules by filtering `value` declarations" $
- runDeclaration [moduleADecl]
+ runDeclaration [D.Value]
[moduleA, moduleB, moduleD] `shouldBe` [moduleA, moduleB]
it "removes everything if no `value` declarations has been found" $
- runDeclaration [moduleADecl]
+ runDeclaration [D.Value]
[moduleD, moduleG, moduleE, moduleH] `shouldBe` []
it "extracts module by filtering `type` declarations" $
- runDeclaration [moduleCDecl]
+ runDeclaration [D.Type]
[moduleA, moduleB, moduleC, moduleD, moduleE] `shouldBe` [moduleC]
it "removes everything if a `type` declaration have not been found" $
- runDeclaration [moduleCDecl]
+ runDeclaration [D.Type]
[moduleA, moduleG, moduleE, moduleH] `shouldBe` []
it "extracts module by filtering `synonym` declarations" $
- runDeclaration [moduleEDecl]
+ runDeclaration [D.Synonym]
[moduleA, moduleB, moduleD, moduleE] `shouldBe` [moduleE]
it "removes everything if a `synonym` declaration have not been found" $
- runDeclaration [moduleEDecl]
+ runDeclaration [D.Synonym]
[moduleA, moduleB, moduleC, moduleH] `shouldBe` []
it "extracts module by filtering `constructor` declarations" $
- runDeclaration [moduleFDecl]
+ runDeclaration [D.DataConstructor]
[moduleA, moduleB, moduleC, moduleF] `shouldBe` [moduleF]
it "removes everything if a `constructor` declaration have not been found" $
- runDeclaration [moduleFDecl]
+ runDeclaration [D.DataConstructor]
[moduleA, moduleB, moduleC, moduleH] `shouldBe` []
it "extracts module by filtering `typeclass` declarations" $
- runDeclaration [moduleGDecl]
+ runDeclaration [D.TypeClass]
[moduleA, moduleC, moduleG] `shouldBe` [moduleG]
it "removes everything if a `typeclass` declaration have not been found" $
- runDeclaration [moduleGDecl]
+ runDeclaration [D.TypeClass]
[moduleA, moduleB, moduleC, moduleH] `shouldBe` []
it "extracts modules by filtering `valueoperator` declarations" $
- runDeclaration [moduleHDecl]
+ runDeclaration [D.ValueOperator]
[moduleA, moduleC, moduleG, moduleH, moduleF] `shouldBe` [moduleH]
it "removes everything if a `valueoperator` declaration have not been found" $
- runDeclaration [moduleHDecl]
+ runDeclaration [D.ValueOperator]
[moduleA, moduleB, moduleC, moduleD] `shouldBe` []
it "extracts modules by filtering `typeoperator` declarations" $
- runDeclaration [moduleIDecl]
+ runDeclaration [D.TypeOperator]
[moduleA, moduleC, moduleG, moduleI, moduleF] `shouldBe` [moduleI]
it "removes everything if a `typeoperator` declaration have not been found" $
- runDeclaration [moduleIDecl]
+ runDeclaration [D.TypeOperator]
[moduleA, moduleD] `shouldBe` []
it "extracts module by filtering `kind` declarations" $
- runDeclaration [moduleCDecl]
- [moduleA, moduleC, moduleG, moduleI, moduleF] `shouldBe` [moduleC]
+ runDeclaration [D.Kind]
+ [moduleA, moduleD, moduleG, moduleI, moduleF] `shouldBe` [moduleD]
it "removes everything if a `kind` declaration have not been found" $
- runDeclaration [moduleCDecl]
- [moduleA, moduleD] `shouldBe` []
+ runDeclaration [D.Kind]
+ [moduleA, moduleC] `shouldBe` []
it "extracts modules by filtering `value` and `synonym` declarations" $
- runDeclaration [moduleADecl, moduleEDecl]
+ runDeclaration [D.Value, D.Synonym]
[moduleA, moduleB, moduleD, moduleE] `shouldBe` [moduleA, moduleB, moduleE]
- it "extracts modules by filtering `kind`, `synonym` and `valueoperator` declarations" $
- runDeclaration [moduleADecl, moduleDDecl, moduleHDecl]
+ it "extracts modules by filtering `value`, `kind`, and `valueoperator` declarations" $
+ runDeclaration [D.Value, D.Kind, D.ValueOperator]
[moduleA, moduleB, moduleD, moduleG, moduleE, moduleH] `shouldBe` [moduleA, moduleB, moduleD, moduleH]
diff --git a/tests/Language/PureScript/Ide/ImportsSpec.hs b/tests/Language/PureScript/Ide/ImportsSpec.hs
index f84d088..5c29c86 100644
--- a/tests/Language/PureScript/Ide/ImportsSpec.hs
+++ b/tests/Language/PureScript/Ide/ImportsSpec.hs
@@ -3,9 +3,10 @@
module Language.PureScript.Ide.ImportsSpec where
import Protolude hiding (moduleName)
-import Data.Maybe (fromJust)
+import Data.Maybe (fromJust)
+import qualified Data.Set as Set
-import qualified Language.PureScript as P
+import qualified Language.PureScript as P
import Language.PureScript.Ide.Command as Command
import Language.PureScript.Ide.Error
import Language.PureScript.Ide.Imports
@@ -48,9 +49,9 @@ syntaxErrorFile =
]
testSliceImportSection :: [Text] -> (P.ModuleName, [Text], [Import], [Text])
-testSliceImportSection = fromRight . sliceImportSection
+testSliceImportSection = unsafeFromRight . sliceImportSection
where
- fromRight = fromJust . rightToMaybe
+ unsafeFromRight = fromJust . rightToMaybe
withImports :: [Text] -> [Text]
withImports is =
@@ -346,7 +347,7 @@ addExplicitImport i =
addExplicitImportFiltered :: Text -> [P.ModuleName] -> Command
addExplicitImportFiltered i ms =
- Command.Import ("src" </> "ImportsSpec.purs") Nothing [moduleFilter ms] (Command.AddImportForIdentifier i Nothing)
+ Command.Import ("src" </> "ImportsSpec.purs") Nothing [moduleFilter (Set.fromList ms)] (Command.AddImportForIdentifier i Nothing)
importShouldBe :: [Text] -> [Text] -> Expectation
importShouldBe res importSection =
diff --git a/tests/Language/PureScript/Ide/SourceFileSpec.hs b/tests/Language/PureScript/Ide/SourceFileSpec.hs
index 2ef859e..20a6258 100644
--- a/tests/Language/PureScript/Ide/SourceFileSpec.hs
+++ b/tests/Language/PureScript/Ide/SourceFileSpec.hs
@@ -93,6 +93,9 @@ spec = do
it "finds a type operator declaration" $ do
Just r <- getLocation "~>"
r `shouldBe` typeOpSS
+ it "finds a module declaration" $ do
+ Just r <- getLocation "SfModule"
+ r `shouldBe` moduleSS
getLocation :: Text -> IO (Maybe P.SourceSpan)
getLocation s = do
@@ -102,7 +105,8 @@ getLocation s = do
where
ideState = emptyIdeState `volatileState`
[ ("Test",
- [ ideValue "sfValue" Nothing `annLoc` valueSS
+ [ ideModule "SfModule" `annLoc` moduleSS
+ , ideValue "sfValue" Nothing `annLoc` valueSS
, ideSynonym "SFType" Nothing Nothing `annLoc` synonymSS
, ideType "SFData" Nothing [] `annLoc` typeSS
, ideDtor "SFOne" "SFData" Nothing `annLoc` typeSS
diff --git a/tests/Language/PureScript/Ide/Test.hs b/tests/Language/PureScript/Ide/Test.hs
index 5cf613f..6164e02 100644
--- a/tests/Language/PureScript/Ide/Test.hs
+++ b/tests/Language/PureScript/Ide/Test.hs
@@ -101,7 +101,11 @@ ideTypeOp opName ident precedence assoc k =
ideKind :: Text -> IdeDeclarationAnn
ideKind pn = ida (IdeDeclKind (P.ProperName pn))
-valueSS, synonymSS, typeSS, classSS, valueOpSS, typeOpSS :: P.SourceSpan
+ideModule :: Text -> IdeDeclarationAnn
+ideModule name = ida (IdeDeclModule (mn name))
+
+moduleSS, valueSS, synonymSS, typeSS, classSS, valueOpSS, typeOpSS :: P.SourceSpan
+moduleSS = ss 1 1
valueSS = ss 3 1
synonymSS = ss 5 1
typeSS = ss 7 1
diff --git a/tests/Main.hs b/tests/Main.hs
index 9214ff3..e7c29b4 100644
--- a/tests/Main.hs
+++ b/tests/Main.hs
@@ -18,6 +18,7 @@ import qualified TestPrimDocs
import qualified TestPsci
import qualified TestIde
import qualified TestPscPublish
+import qualified TestBundle
import qualified TestUtils
import System.IO (hSetEncoding, stdout, stderr, utf8)
@@ -29,14 +30,14 @@ main = do
heading "Updating support code"
TestUtils.updateSupportCode
- heading "Prim documentation test suite"
- TestPrimDocs.main
ideTests <- TestIde.main
compilerTests <- TestCompiler.main
psciTests <- TestPsci.main
+ pscBundleTests <- TestBundle.main
coreFnTests <- TestCoreFn.main
docsTests <- TestDocs.main
+ primDocsTests <- TestPrimDocs.main
publishTests <- TestPscPublish.main
hierarchyTests <- TestHierarchy.main
@@ -45,9 +46,11 @@ main = do
"Tests"
[ compilerTests
, psciTests
+ , pscBundleTests
, ideTests
, coreFnTests
, docsTests
+ , primDocsTests
, publishTests
, hierarchyTests
]
diff --git a/tests/TestBundle.hs b/tests/TestBundle.hs
new file mode 100644
index 0000000..cbdcf68
--- /dev/null
+++ b/tests/TestBundle.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DoAndIfThenElse #-}
+{-# LANGUAGE TupleSections #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE OverloadedStrings #-}
+
+module TestBundle where
+
+import Prelude ()
+import Prelude.Compat
+
+import qualified Language.PureScript as P
+import Language.PureScript.Bundle
+
+import Data.Function (on)
+import Data.List (minimumBy)
+
+import qualified Data.Map as M
+
+import Control.Monad
+import Control.Monad.IO.Class (liftIO)
+import Control.Monad.Trans.Except
+
+import System.Exit
+import System.Process
+import System.FilePath
+import System.IO
+import System.IO.UTF8
+import qualified System.FilePath.Glob as Glob
+
+import TestUtils
+import Test.Tasty
+import Test.Tasty.Hspec
+
+main :: IO TestTree
+main = testSpec "bundle" spec
+
+spec :: Spec
+spec = do
+ (supportModules, supportExterns, supportForeigns) <- runIO $ setupSupportModules
+ bundleTestCases <- runIO $ getTestFiles "bundle"
+ outputFile <- runIO $ createOutputFile logfile
+
+ context "Bundle examples" $
+ forM_ bundleTestCases $ \testPurs -> do
+ it ("'" <> takeFileName (getTestMain testPurs) <> "' should compile, bundle and run without error") $
+ assertBundles supportModules supportExterns supportForeigns testPurs outputFile
+ where
+
+ -- Takes the test entry point from a group of purs files - this is determined
+ -- by the file with the shortest path name, as everything but the main file
+ -- will be under a subdirectory.
+ getTestMain :: [FilePath] -> FilePath
+ getTestMain = minimumBy (compare `on` length)
+
+assertBundles
+ :: [P.Module]
+ -> [P.ExternsFile]
+ -> M.Map P.ModuleName FilePath
+ -> [FilePath]
+ -> Handle
+ -> Expectation
+assertBundles supportModules supportExterns supportForeigns inputFiles outputFile =
+ assert supportModules supportExterns supportForeigns inputFiles checkMain $ \e ->
+ case e of
+ Left errs -> return . Just . P.prettyPrintMultipleErrors P.defaultPPEOptions $ errs
+ Right _ -> do
+ process <- findNodeProcess
+ jsFiles <- Glob.globDir1 (Glob.compile "**/*.js") modulesDir
+ let entryPoint = modulesDir </> "index.js"
+ let entryModule = map (`ModuleIdentifier` Regular) ["Main"]
+ bundled <- runExceptT $ do
+ input <- forM jsFiles $ \filename -> do
+ js <- liftIO $ readUTF8File filename
+ mid <- guessModuleIdentifier filename
+ length js `seq` return (mid, Just filename, js)
+ bundleSM input entryModule (Just $ "Main") "PS" (Just entryPoint)
+ case bundled of
+ Right (_, js) -> do
+ writeUTF8File entryPoint js
+ result <- traverse (\node -> readProcessWithExitCode node [entryPoint] "") process
+ hPutStrLn outputFile $ "\n" <> takeFileName (last inputFiles) <> ":"
+ case result of
+ Just (ExitSuccess, out, err)
+ | not (null err) -> return $ Just $ "Test wrote to stderr:\n\n" <> err
+ | not (null out) && trim (last (lines out)) == "Done" -> do
+ hPutStr outputFile out
+ return Nothing
+ | otherwise -> return $ Just $ "Test did not finish with 'Done':\n\n" <> out
+ Just (ExitFailure _, _, err) -> return $ Just err
+ Nothing -> return $ Just "Couldn't find node.js executable"
+ Left err -> return . Just $ "Coud not bundle: " ++ show err
+
+logfile :: FilePath
+logfile = "bundle-tests.out"
diff --git a/tests/TestCompiler.hs b/tests/TestCompiler.hs
index ddd7eda..5c082da 100644
--- a/tests/TestCompiler.hs
+++ b/tests/TestCompiler.hs
@@ -26,29 +26,21 @@ import Prelude.Compat
import qualified Language.PureScript as P
-import Data.Char (isSpace)
+import Control.Arrow ((>>>))
import Data.Function (on)
-import Data.List (sort, stripPrefix, intercalate, groupBy, sortBy, minimumBy)
+import Data.List (sort, stripPrefix, intercalate, minimumBy)
import Data.Maybe (mapMaybe)
-import Data.Time.Clock (UTCTime())
import qualified Data.Text as T
-import Data.Tuple (swap)
import qualified Data.Map as M
import Control.Monad
-import Control.Arrow ((***), (>>>))
-
-import Control.Monad.Reader
-import Control.Monad.Trans.Except
import System.Exit
-import System.Process hiding (cwd)
+import System.Process
import System.FilePath
-import System.Directory
import System.IO
-import System.IO.UTF8
-import qualified System.FilePath.Glob as Glob
+import System.IO.UTF8 (readUTF8File)
import TestUtils
import Test.Tasty
@@ -59,29 +51,14 @@ main = testSpec "compiler" spec
spec :: Spec
spec = do
+ (supportModules, supportExterns, supportForeigns) <- runIO $ setupSupportModules
+
+ (passingTestCases, warningTestCases, failingTestCases) <- runIO $
+ (,,) <$> getTestFiles "passing"
+ <*> getTestFiles "warning"
+ <*> getTestFiles "failing"
- (supportModules, supportExterns, supportForeigns, passingTestCases, warningTestCases, failingTestCases) <- runIO $ do
- cwd <- getCurrentDirectory
- let passing = cwd </> "tests" </> "purs" </> "passing"
- let warning = cwd </> "tests" </> "purs" </> "warning"
- let failing = cwd </> "tests" </> "purs" </> "failing"
- passingFiles <- getTestFiles passing <$> testGlob passing
- warningFiles <- getTestFiles warning <$> testGlob warning
- failingFiles <- getTestFiles failing <$> testGlob failing
- ms <- getSupportModuleTuples
- let modules = map snd ms
- supportExterns <- runExceptT $ do
- foreigns <- inferForeignModules ms
- externs <- ExceptT . fmap fst . runTest $ P.make (makeActions modules foreigns) modules
- return (externs, foreigns)
- case supportExterns of
- Left errs -> fail (P.prettyPrintMultipleErrors P.defaultPPEOptions errs)
- Right (externs, foreigns) -> return (modules, externs, foreigns, passingFiles, warningFiles, failingFiles)
-
- outputFile <- runIO $ do
- tmp <- getTemporaryDirectory
- createDirectoryIfMissing False (tmp </> logpath)
- openFile (tmp </> logpath </> logfile) WriteMode
+ outputFile <- runIO $ createOutputFile logfile
context "Passing examples" $
forM_ passingTestCases $ \testPurs ->
@@ -104,36 +81,12 @@ spec = do
where
- -- A glob for all purs and js files within a test directory
- testGlob :: FilePath -> IO [FilePath]
- testGlob = Glob.globDir1 (Glob.compile "**/*.purs")
-
- -- Groups the test files so that a top-level file can have dependencies in a
- -- subdirectory of the same name. The inner tuple contains a list of the
- -- .purs files and the .js files for the test case.
- getTestFiles :: FilePath -> [FilePath] -> [[FilePath]]
- getTestFiles baseDir
- = map (filter ((== ".purs") . takeExtensions) . map (baseDir </>))
- . groupBy ((==) `on` extractPrefix)
- . sortBy (compare `on` extractPrefix)
- . map (makeRelative baseDir)
-
-- Takes the test entry point from a group of purs files - this is determined
-- by the file with the shortest path name, as everything but the main file
-- will be under a subdirectory.
getTestMain :: [FilePath] -> FilePath
getTestMain = minimumBy (compare `on` length)
- -- Extracts the filename part of a .purs file, or if the file is in a
- -- subdirectory, the first part of that directory path.
- extractPrefix :: FilePath -> FilePath
- extractPrefix fp =
- let dir = takeDirectory fp
- ext = reverse ".purs"
- in if dir == "."
- then maybe fp reverse $ stripPrefix ext $ reverse fp
- else dir
-
-- Scans a file for @shouldFailWith directives in the comments, used to
-- determine expected failures
getShouldFailWith :: FilePath -> IO [String]
@@ -147,80 +100,8 @@ spec = do
extractPragma :: String -> FilePath -> IO [String]
extractPragma pragma = fmap go . readUTF8File
where
- go = lines >>> mapMaybe (stripPrefix ("-- @" ++ pragma ++ " ")) >>> map trim
-
-inferForeignModules
- :: MonadIO m
- => [(FilePath, P.Module)]
- -> m (M.Map P.ModuleName FilePath)
-inferForeignModules = P.inferForeignModules . fromList
- where
- fromList :: [(FilePath, P.Module)] -> M.Map P.ModuleName (Either P.RebuildPolicy FilePath)
- fromList = M.fromList . map ((P.getModuleName *** Right) . swap)
-
-trim :: String -> String
-trim = dropWhile isSpace >>> reverse >>> dropWhile isSpace >>> reverse
-
-modulesDir :: FilePath
-modulesDir = ".test_modules" </> "node_modules"
-
-makeActions :: [P.Module] -> M.Map P.ModuleName FilePath -> P.MakeActions P.Make
-makeActions modules foreigns = (P.buildMakeActions modulesDir (P.internalError "makeActions: input file map was read.") foreigns False)
- { P.getInputTimestamp = getInputTimestamp
- , P.getOutputTimestamp = getOutputTimestamp
- , P.progress = const (pure ())
- }
- where
- getInputTimestamp :: P.ModuleName -> P.Make (Either P.RebuildPolicy (Maybe UTCTime))
- getInputTimestamp mn
- | isSupportModule (P.runModuleName mn) = return (Left P.RebuildNever)
- | otherwise = return (Left P.RebuildAlways)
- where
- isSupportModule = flip elem (map (P.runModuleName . P.getModuleName) modules)
-
- getOutputTimestamp :: P.ModuleName -> P.Make (Maybe UTCTime)
- getOutputTimestamp mn = do
- let filePath = modulesDir </> T.unpack (P.runModuleName mn)
- exists <- liftIO $ doesDirectoryExist filePath
- return (if exists then Just (P.internalError "getOutputTimestamp: read timestamp") else Nothing)
+ go = lines >>> mapMaybe (stripPrefix ("-- @" ++ pragma ++ " ")) >>> map trim
-runTest :: P.Make a -> IO (Either P.MultipleErrors a, P.MultipleErrors)
-runTest = P.runMake P.defaultOptions
-
-compile
- :: [P.Module]
- -> [P.ExternsFile]
- -> M.Map P.ModuleName FilePath
- -> [FilePath]
- -> ([P.Module] -> IO ())
- -> IO (Either P.MultipleErrors [P.ExternsFile], P.MultipleErrors)
-compile supportModules supportExterns supportForeigns inputFiles check = runTest $ do
- fs <- liftIO $ readInput inputFiles
- ms <- P.parseModulesFromFiles id fs
- foreigns <- inferForeignModules ms
- liftIO (check (map snd ms))
- let actions = makeActions supportModules (foreigns `M.union` supportForeigns)
- case ms of
- [singleModule] -> pure <$> P.rebuildModule actions supportExterns (snd singleModule)
- _ -> P.make actions (supportModules ++ map snd ms)
-
-assert
- :: [P.Module]
- -> [P.ExternsFile]
- -> M.Map P.ModuleName FilePath
- -> [FilePath]
- -> ([P.Module] -> IO ())
- -> (Either P.MultipleErrors P.MultipleErrors -> IO (Maybe String))
- -> Expectation
-assert supportModules supportExterns supportForeigns inputFiles check f = do
- (e, w) <- compile supportModules supportExterns supportForeigns inputFiles check
- maybeErr <- f (const w <$> e)
- maybe (return ()) expectationFailure maybeErr
-
-checkMain :: [P.Module] -> IO ()
-checkMain ms =
- unless (any ((== P.moduleNameFromString "Main") . P.getModuleName) ms)
- (fail "Main module missing")
checkShouldFailWith :: [String] -> P.MultipleErrors -> Maybe String
checkShouldFailWith expected errs =
@@ -323,8 +204,5 @@ assertDoesNotCompile supportModules supportExterns supportForeigns inputFiles sh
where
noPreCheck = const (return ())
-logpath :: FilePath
-logpath = "purescript-output"
-
logfile :: FilePath
logfile = "psc-tests.out"
diff --git a/tests/TestDocs.hs b/tests/TestDocs.hs
index 7a2ba81..9c7bdfb 100644
--- a/tests/TestDocs.hs
+++ b/tests/TestDocs.hs
@@ -275,7 +275,7 @@ displayAssertionFailure = \case
"expected " <> decl <> " to be a " <> expected <> " declaration, but it" <>
" was a " <> actual <> " declaration"
DeclarationWrongType _ decl actual ->
- decl <> " had the wrong type; got " <> T.pack (P.prettyPrintType actual)
+ decl <> " had the wrong type; got " <> T.pack (P.prettyPrintType maxBound actual)
TypeSynonymMismatch _ decl expected actual ->
"expected the RHS of " <> decl <> " to be " <> expected <>
"; got " <> actual
@@ -294,8 +294,8 @@ displayAssertionFailure = \case
"in rendered code for " <> decl <> ", bad link location for " <> target <>
": expected " <> T.pack (show expected) <>
" got " <> T.pack (show actual)
- WrongOrder _ before after ->
- "expected to see " <> before <> " before " <> after
+ WrongOrder _ before after' ->
+ "expected to see " <> before <> " before " <> after'
displayTagsAssertionFailure :: TagsAssertionFailure -> Text
displayTagsAssertionFailure = \case
@@ -438,22 +438,22 @@ runAssertion assertion linksCtx Docs.Module{..} =
Nothing ->
Fail (LinkedDeclarationMissing mn decl destTitle)
- ShouldComeBefore mn before after ->
+ ShouldComeBefore mn before after' ->
let
decls = declarationsFor mn
indexOf :: Text -> Maybe Int
indexOf title = findIndex ((==) title . Docs.declTitle) decls
in
- case (indexOf before, indexOf after) of
+ case (indexOf before, indexOf after') of
(Just i, Just j) ->
if i < j
then Pass
- else Fail (WrongOrder mn before after)
+ else Fail (WrongOrder mn before after')
(Nothing, _) ->
Fail (NotDocumented mn before)
(_, Nothing) ->
- Fail (NotDocumented mn after)
+ Fail (NotDocumented mn after')
where
declarationsFor mn =
diff --git a/tests/TestPrimDocs.hs b/tests/TestPrimDocs.hs
index ef545de..03d94d8 100644
--- a/tests/TestPrimDocs.hs
+++ b/tests/TestPrimDocs.hs
@@ -2,38 +2,40 @@ module TestPrimDocs where
import Prelude
-import Control.Monad
-import Data.List ((\\))
+import Data.List (sort)
+import Control.Exception (evaluate)
+import Control.DeepSeq (force)
import qualified Data.Map as Map
import qualified Data.Set as Set
import qualified Language.PureScript as P
import qualified Language.PureScript.Docs as D
-import qualified Language.PureScript.Docs.AsMarkdown as D
-main :: IO ()
-main = do
- putStrLn "Test that there are no bottoms hiding in primDocsModule"
- seq (D.runDocs (D.modulesAsMarkdown D.primModules)) (return ())
+import Test.Tasty
+import Test.Tasty.Hspec (Spec, testSpec, it)
+import Test.Hspec (shouldBe)
- putStrLn "Test that Prim is fully documented"
- let actualPrimNames =
- -- note that prim type classes are listed in P.primTypes
- (map (P.runProperName . P.disqualify . fst) $ Map.toList
- ( P.primTypes <>
- P.primBooleanTypes <>
- P.primOrderingTypes <>
- P.primRowTypes <>
- P.primRowListTypes <>
- P.primTypeErrorTypes <>
- P.primSymbolTypes )) ++
- (map (P.runProperName . P.disqualify) $ Set.toList P.allPrimKinds)
- let documentedPrimNames = map D.declTitle (concatMap D.modDeclarations D.primModules)
+main :: IO TestTree
+main = testSpec "prim docs" spec
- let undocumentedNames = actualPrimNames \\ documentedPrimNames
- let extraNames = documentedPrimNames \\ actualPrimNames
+spec :: Spec
+spec = do
+ it "there are no bottoms hiding in primModules" $ do
+ _ <- evaluate (force D.primModules)
+ return ()
- when (not (null undocumentedNames)) $
- error $ "Undocumented Prim names: " ++ show undocumentedNames
+ it "all Prim modules are fully documented" $ do
+ let actualPrimNames =
+ -- note that prim type classes are listed in P.primTypes
+ (map (P.runProperName . P.disqualify . fst) $ Map.toList
+ ( P.primTypes <>
+ P.primBooleanTypes <>
+ P.primOrderingTypes <>
+ P.primRowTypes <>
+ P.primRowListTypes <>
+ P.primTypeErrorTypes <>
+ P.primSymbolTypes )) ++
+ (map (P.runProperName . P.disqualify) $ Set.toList P.allPrimKinds)
+ let documentedPrimNames =
+ map D.declTitle (concatMap D.modDeclarations D.primModules)
- when (not (null extraNames)) $
- error $ "Extra Prim names: " ++ show extraNames
+ sort documentedPrimNames `shouldBe` sort actualPrimNames
diff --git a/tests/TestPscPublish.hs b/tests/TestPscPublish.hs
index d32853e..64dda76 100644
--- a/tests/TestPscPublish.hs
+++ b/tests/TestPscPublish.hs
@@ -29,10 +29,21 @@ main = testSpec "publish" spec
spec :: Spec
spec = do
- it "roundtrips the json for purescript-prelude" $ do
- testPackage
- "tests/support/bower_components/purescript-prelude"
- "../../prelude-resolutions.json"
+ context "preparePackage with json roundtrips" $ do
+ it "purescript-prelude" $ do
+ testPackage
+ "tests/support/bower_components/purescript-prelude"
+ "../../prelude-resolutions.json"
+
+ it "basic example" $ do
+ testPackage
+ "tests/purs/publish/basic-example"
+ "resolutions.json"
+
+ it "basic example with legacy resolutions file" $ do
+ testPackage
+ "tests/purs/publish/basic-example"
+ "resolutions-legacy.json"
context "json compatibility" $ do
let compatDir = "tests" </> "json-compat"
@@ -61,10 +72,10 @@ roundTrip pkg =
in case A.eitherDecode before of
Left err -> ParseFailed err
Right parsed -> do
- let after = A.encode (parsed :: UploadedPackage)
- if before == after
+ let after' = A.encode (parsed :: UploadedPackage)
+ if before == after'
then Pass before
- else Mismatch before after
+ else Mismatch before after'
testRunOptions :: PublishOptions
testRunOptions = defaultPublishOptions
diff --git a/tests/TestUtils.hs b/tests/TestUtils.hs
index 6c70807..f2c477f 100644
--- a/tests/TestUtils.hs
+++ b/tests/TestUtils.hs
@@ -1,4 +1,6 @@
{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE OverloadedStrings #-}
+
module TestUtils where
@@ -7,20 +9,29 @@ import Prelude.Compat
import qualified Language.PureScript as P
+import Control.Arrow ((***), (>>>))
import Control.Monad
+import Control.Monad.Reader
import Control.Monad.Trans.Except
import Control.Monad.Trans.Maybe
import Control.Exception
-import Data.List (sort)
+import Data.Char (isSpace)
+import Data.Function (on)
+import Data.List (sort, sortBy, stripPrefix, groupBy)
+import qualified Data.Map as M
import qualified Data.Text as T
-import System.Process
+import Data.Time.Clock (UTCTime())
+import Data.Tuple (swap)
+import System.Process hiding (cwd)
import System.Directory
import System.Info
import System.IO.UTF8 (readUTF8FileT)
import System.Exit (exitFailure)
-import System.FilePath ((</>))
+import System.FilePath
import qualified System.FilePath.Glob as Glob
-import System.IO (stderr, hPutStrLn)
+import System.IO
+import Test.Tasty.Hspec
+
findNodeProcess :: IO (Maybe String)
findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names
@@ -86,3 +97,142 @@ pushd dir act = do
result <- try act :: IO (Either IOException a)
setCurrentDirectory original
either throwIO return result
+
+
+createOutputFile :: FilePath -> IO Handle
+createOutputFile logfileName = do
+ tmp <- getTemporaryDirectory
+ createDirectoryIfMissing False (tmp </> logpath)
+ openFile (tmp </> logpath </> logfileName) WriteMode
+
+setupSupportModules :: IO ([P.Module], [P.ExternsFile], M.Map P.ModuleName FilePath)
+setupSupportModules = do
+ ms <- getSupportModuleTuples
+ let modules = map snd ms
+ supportExterns <- runExceptT $ do
+ foreigns <- inferForeignModules ms
+ externs <- ExceptT . fmap fst . runTest $ P.make (makeActions modules foreigns) modules
+ return (externs, foreigns)
+ case supportExterns of
+ Left errs -> fail (P.prettyPrintMultipleErrors P.defaultPPEOptions errs)
+ Right (externs, foreigns) -> return (modules, externs, foreigns)
+
+getTestFiles :: FilePath -> IO [[FilePath]]
+getTestFiles testDir = do
+ cwd <- getCurrentDirectory
+ let dir = cwd </> "tests" </> "purs" </> testDir
+ testsInPath <- getFiles dir <$> testGlob dir
+ let rerunPath = dir </> "RerunCompilerTests.txt"
+ hasRerunFile <- doesFileExist rerunPath
+ rerunTests <-
+ if hasRerunFile
+ then let compilerTestDir = cwd </> "tests" </> "purs" </> "passing"
+ textToTestFiles
+ = mapM (\path -> ((path ++ ".purs") :) <$> testGlob path)
+ . map ((compilerTestDir </>) . T.unpack)
+ . filter (not . T.null)
+ . map (T.strip . fst . T.breakOn "--")
+ . T.lines
+ in readUTF8FileT rerunPath >>= textToTestFiles
+ else return []
+ return $ testsInPath ++ rerunTests
+ where
+ -- A glob for all purs and js files within a test directory
+ testGlob :: FilePath -> IO [FilePath]
+ testGlob = Glob.globDir1 (Glob.compile "**/*.purs")
+ -- Groups the test files so that a top-level file can have dependencies in a
+ -- subdirectory of the same name. The inner tuple contains a list of the
+ -- .purs files and the .js files for the test case.
+ getFiles :: FilePath -> [FilePath] -> [[FilePath]]
+ getFiles baseDir
+ = map (filter ((== ".purs") . takeExtensions) . map (baseDir </>))
+ . groupBy ((==) `on` extractPrefix)
+ . sortBy (compare `on` extractPrefix)
+ . map (makeRelative baseDir)
+ -- Extracts the filename part of a .purs file, or if the file is in a
+ -- subdirectory, the first part of that directory path.
+ extractPrefix :: FilePath -> FilePath
+ extractPrefix fp =
+ let dir = takeDirectory fp
+ ext = reverse ".purs"
+ in if dir == "."
+ then maybe fp reverse $ stripPrefix ext $ reverse fp
+ else dir
+
+compile
+ :: [P.Module]
+ -> [P.ExternsFile]
+ -> M.Map P.ModuleName FilePath
+ -> [FilePath]
+ -> ([P.Module] -> IO ())
+ -> IO (Either P.MultipleErrors [P.ExternsFile], P.MultipleErrors)
+compile supportModules supportExterns supportForeigns inputFiles check = runTest $ do
+ fs <- liftIO $ readInput inputFiles
+ ms <- P.parseModulesFromFiles id fs
+ foreigns <- inferForeignModules ms
+ liftIO (check (map snd ms))
+ let actions = makeActions supportModules (foreigns `M.union` supportForeigns)
+ case ms of
+ [singleModule] -> pure <$> P.rebuildModule actions supportExterns (snd singleModule)
+ _ -> P.make actions (supportModules ++ map snd ms)
+
+assert
+ :: [P.Module]
+ -> [P.ExternsFile]
+ -> M.Map P.ModuleName FilePath
+ -> [FilePath]
+ -> ([P.Module] -> IO ())
+ -> (Either P.MultipleErrors P.MultipleErrors -> IO (Maybe String))
+ -> Expectation
+assert supportModules supportExterns supportForeigns inputFiles check f = do
+ (e, w) <- compile supportModules supportExterns supportForeigns inputFiles check
+ maybeErr <- f (const w <$> e)
+ maybe (return ()) expectationFailure maybeErr
+
+checkMain :: [P.Module] -> IO ()
+checkMain ms =
+ unless (any ((== P.moduleNameFromString "Main") . P.getModuleName) ms)
+ (fail "Main module missing")
+
+
+makeActions :: [P.Module] -> M.Map P.ModuleName FilePath -> P.MakeActions P.Make
+makeActions modules foreigns = (P.buildMakeActions modulesDir (P.internalError "makeActions: input file map was read.") foreigns False)
+ { P.getInputTimestamp = getInputTimestamp
+ , P.getOutputTimestamp = getOutputTimestamp
+ , P.progress = const (pure ())
+ }
+ where
+ getInputTimestamp :: P.ModuleName -> P.Make (Either P.RebuildPolicy (Maybe UTCTime))
+ getInputTimestamp mn
+ | isSupportModule (P.runModuleName mn) = return (Left P.RebuildNever)
+ | otherwise = return (Left P.RebuildAlways)
+ where
+ isSupportModule = flip elem (map (P.runModuleName . P.getModuleName) modules)
+
+ getOutputTimestamp :: P.ModuleName -> P.Make (Maybe UTCTime)
+ getOutputTimestamp mn = do
+ let filePath = modulesDir </> T.unpack (P.runModuleName mn)
+ exists <- liftIO $ doesDirectoryExist filePath
+ return (if exists then Just (P.internalError "getOutputTimestamp: read timestamp") else Nothing)
+
+
+runTest :: P.Make a -> IO (Either P.MultipleErrors a, P.MultipleErrors)
+runTest = P.runMake P.defaultOptions
+
+inferForeignModules
+ :: MonadIO m
+ => [(FilePath, P.Module)]
+ -> m (M.Map P.ModuleName FilePath)
+inferForeignModules = P.inferForeignModules . fromList
+ where
+ fromList :: [(FilePath, P.Module)] -> M.Map P.ModuleName (Either P.RebuildPolicy FilePath)
+ fromList = M.fromList . map ((P.getModuleName *** Right) . swap)
+
+trim :: String -> String
+trim = dropWhile isSpace >>> reverse >>> dropWhile isSpace >>> reverse
+
+modulesDir :: FilePath
+modulesDir = ".test_modules" </> "node_modules"
+
+logpath :: FilePath
+logpath = "purescript-output"
diff --git a/tests/purs/bundle/PSasConstructor.purs b/tests/purs/bundle/PSasConstructor.purs
new file mode 100644
index 0000000..d30721a
--- /dev/null
+++ b/tests/purs/bundle/PSasConstructor.purs
@@ -0,0 +1,11 @@
+module Main where
+
+import Prelude
+import Effect (Effect)
+import Effect.Console (log)
+
+data P = PS
+
+main :: Effect Unit
+main = do
+ log "Done"
diff --git a/tests/purs/failing/Superclasses2.purs b/tests/purs/failing/Superclasses2.purs
index 0c50349..3c86b7f 100644
--- a/tests/purs/failing/Superclasses2.purs
+++ b/tests/purs/failing/Superclasses2.purs
@@ -1,5 +1,4 @@
--- @shouldFailWith CycleInTypeSynonym
--- TODO: Should this have its own error, perhaps CycleInTypeClassDeclaration?
+-- @shouldFailWith CycleInTypeClassDeclaration
module CycleInSuperclasses where
import Prelude
diff --git a/tests/purs/publish/basic-example/bower.json b/tests/purs/publish/basic-example/bower.json
new file mode 100644
index 0000000..23962c2
--- /dev/null
+++ b/tests/purs/publish/basic-example/bower.json
@@ -0,0 +1,13 @@
+{
+ "name": "basic-example",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/purescript/test.git"
+ },
+ "license": "MIT",
+ "dependencies": {
+ "purescript-console": "^1.0.0",
+ "purescript-prelude": "^1.0.0",
+ "purescript-effect": "^1.0.0"
+ }
+}
diff --git a/tests/purs/publish/basic-example/resolutions-legacy.json b/tests/purs/publish/basic-example/resolutions-legacy.json
new file mode 100644
index 0000000..c08e4d9
--- /dev/null
+++ b/tests/purs/publish/basic-example/resolutions-legacy.json
@@ -0,0 +1,640 @@
+{
+ "endpoint": {
+ "name": "basic-example",
+ "source": ".",
+ "target": "*"
+ },
+ "canonicalDir": ".",
+ "pkgMeta": {
+ "name": "basic-example",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "output"
+ ],
+ "dependencies": {
+ "purescript-prelude": "^4.1.0",
+ "purescript-console": "^4.2.0",
+ "purescript-effect": "^2.0.1",
+ "purescript-newtype": "#master"
+ },
+ "devDependencies": {
+ "purescript-psci-support": "^4.0.0"
+ }
+ },
+ "dependencies": {
+ "purescript-console": {
+ "endpoint": {
+ "name": "purescript-console",
+ "source": "purescript-console",
+ "target": "^4.2.0"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-console",
+ "pkgMeta": {
+ "name": "purescript-console",
+ "homepage": "https://github.com/purescript/purescript-console",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-console.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "dependencies": {
+ "purescript-effect": "^2.0.0",
+ "purescript-prelude": "^4.0.0"
+ },
+ "version": "4.2.0",
+ "_release": "4.2.0",
+ "_resolution": {
+ "type": "version",
+ "tag": "v4.2.0",
+ "commit": "add2bdb8a4af2213d993b728805f1f2a5e76deb8"
+ },
+ "_source": "https://github.com/purescript/purescript-console.git",
+ "_target": "^4.2.0",
+ "_originalSource": "purescript-console"
+ },
+ "dependencies": {
+ "purescript-effect": {
+ "endpoint": {
+ "name": "purescript-effect",
+ "source": "purescript-effect",
+ "target": "^2.0.0"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-effect",
+ "pkgMeta": {
+ "name": "purescript-effect",
+ "homepage": "https://github.com/purescript/purescript-effect",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-effect.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "dependencies": {
+ "purescript-prelude": "^4.0.0"
+ },
+ "version": "2.0.1",
+ "_release": "2.0.1",
+ "_resolution": {
+ "type": "version",
+ "tag": "v2.0.1",
+ "commit": "d2a11e69abcda3b81c750e86e8746cda278f47bf"
+ },
+ "_source": "https://github.com/purescript/purescript-effect.git",
+ "_target": "^2.0.1",
+ "_originalSource": "purescript-effect"
+ },
+ "dependencies": {
+ "purescript-prelude": {
+ "endpoint": {
+ "name": "purescript-prelude",
+ "source": "purescript-prelude",
+ "target": "^4.0.0"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-prelude",
+ "pkgMeta": {
+ "name": "purescript-prelude",
+ "homepage": "https://github.com/purescript/purescript-prelude",
+ "description": "The PureScript Prelude",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-prelude.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "version": "4.1.0",
+ "_release": "4.1.0",
+ "_resolution": {
+ "type": "version",
+ "tag": "v4.1.0",
+ "commit": "7a691ce2658bd8eaf28439391e29506dd154fb3d"
+ },
+ "_source": "https://github.com/purescript/purescript-prelude.git",
+ "_target": "^4.1.0",
+ "_originalSource": "purescript-prelude"
+ },
+ "dependencies": {},
+ "nrDependants": 1
+ }
+ },
+ "nrDependants": 1
+ },
+ "purescript-prelude": {
+ "endpoint": {
+ "name": "purescript-prelude",
+ "source": "purescript-prelude",
+ "target": "^4.0.0"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-prelude",
+ "pkgMeta": {
+ "name": "purescript-prelude",
+ "homepage": "https://github.com/purescript/purescript-prelude",
+ "description": "The PureScript Prelude",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-prelude.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "version": "4.1.0",
+ "_release": "4.1.0",
+ "_resolution": {
+ "type": "version",
+ "tag": "v4.1.0",
+ "commit": "7a691ce2658bd8eaf28439391e29506dd154fb3d"
+ },
+ "_source": "https://github.com/purescript/purescript-prelude.git",
+ "_target": "^4.1.0",
+ "_originalSource": "purescript-prelude"
+ },
+ "dependencies": {},
+ "nrDependants": 1
+ }
+ },
+ "nrDependants": 1
+ },
+ "purescript-effect": {
+ "endpoint": {
+ "name": "purescript-effect",
+ "source": "purescript-effect",
+ "target": "^2.0.1"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-effect",
+ "pkgMeta": {
+ "name": "purescript-effect",
+ "homepage": "https://github.com/purescript/purescript-effect",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-effect.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "dependencies": {
+ "purescript-prelude": "^4.0.0"
+ },
+ "version": "2.0.1",
+ "_release": "2.0.1",
+ "_resolution": {
+ "type": "version",
+ "tag": "v2.0.1",
+ "commit": "d2a11e69abcda3b81c750e86e8746cda278f47bf"
+ },
+ "_source": "https://github.com/purescript/purescript-effect.git",
+ "_target": "^2.0.1",
+ "_originalSource": "purescript-effect"
+ },
+ "dependencies": {},
+ "nrDependants": 1
+ },
+ "purescript-newtype": {
+ "endpoint": {
+ "name": "purescript-newtype",
+ "source": "purescript-newtype",
+ "target": "master"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-newtype",
+ "pkgMeta": {
+ "name": "purescript-newtype",
+ "homepage": "https://github.com/purescript/purescript-newtype",
+ "description": "Type class and functions for working with newtypes",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-newtype.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "dependencies": {
+ "purescript-prelude": "^4.0.0"
+ },
+ "_release": "7d85fa6a04",
+ "_resolution": {
+ "type": "branch",
+ "branch": "master",
+ "commit": "7d85fa6a040208c010b05f7c23af6a943ba08763"
+ },
+ "_source": "https://github.com/garyb/purescript-newtype.git",
+ "_target": "master",
+ "_originalSource": "purescript-newtype"
+ },
+ "dependencies": {
+ "purescript-prelude": {
+ "endpoint": {
+ "name": "purescript-prelude",
+ "source": "purescript-prelude",
+ "target": "^4.0.0"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-prelude",
+ "pkgMeta": {
+ "name": "purescript-prelude",
+ "homepage": "https://github.com/purescript/purescript-prelude",
+ "description": "The PureScript Prelude",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-prelude.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "version": "4.1.0",
+ "_release": "4.1.0",
+ "_resolution": {
+ "type": "version",
+ "tag": "v4.1.0",
+ "commit": "7a691ce2658bd8eaf28439391e29506dd154fb3d"
+ },
+ "_source": "https://github.com/purescript/purescript-prelude.git",
+ "_target": "^4.1.0",
+ "_originalSource": "purescript-prelude"
+ },
+ "dependencies": {},
+ "nrDependants": 1
+ }
+ },
+ "nrDependants": 1
+ },
+ "purescript-prelude": {
+ "endpoint": {
+ "name": "purescript-prelude",
+ "source": "purescript-prelude",
+ "target": "^4.1.0"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-prelude",
+ "pkgMeta": {
+ "name": "purescript-prelude",
+ "homepage": "https://github.com/purescript/purescript-prelude",
+ "description": "The PureScript Prelude",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-prelude.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "version": "4.1.0",
+ "_release": "4.1.0",
+ "_resolution": {
+ "type": "version",
+ "tag": "v4.1.0",
+ "commit": "7a691ce2658bd8eaf28439391e29506dd154fb3d"
+ },
+ "_source": "https://github.com/purescript/purescript-prelude.git",
+ "_target": "^4.1.0",
+ "_originalSource": "purescript-prelude"
+ },
+ "dependencies": {},
+ "nrDependants": 1
+ },
+ "purescript-psci-support": {
+ "endpoint": {
+ "name": "purescript-psci-support",
+ "source": "purescript-psci-support",
+ "target": "^4.0.0"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-psci-support",
+ "pkgMeta": {
+ "name": "purescript-psci-support",
+ "homepage": "https://github.com/purescript/purescript-psci-support",
+ "description": "Support module for the PSCI interactive mode",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-psci-support.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "bower.json",
+ "package.json"
+ ],
+ "dependencies": {
+ "purescript-console": "^4.0.0",
+ "purescript-effect": "^2.0.0",
+ "purescript-prelude": "^4.0.0"
+ },
+ "version": "4.0.0",
+ "_release": "4.0.0",
+ "_resolution": {
+ "type": "version",
+ "tag": "v4.0.0",
+ "commit": "a66a0fa8661eb8b5fe75cc862f4e2df2835c058d"
+ },
+ "_source": "https://github.com/purescript/purescript-psci-support.git",
+ "_target": "^4.0.0",
+ "_originalSource": "purescript-psci-support"
+ },
+ "dependencies": {
+ "purescript-console": {
+ "endpoint": {
+ "name": "purescript-console",
+ "source": "purescript-console",
+ "target": "^4.0.0"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-console",
+ "pkgMeta": {
+ "name": "purescript-console",
+ "homepage": "https://github.com/purescript/purescript-console",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-console.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "dependencies": {
+ "purescript-effect": "^2.0.0",
+ "purescript-prelude": "^4.0.0"
+ },
+ "version": "4.2.0",
+ "_release": "4.2.0",
+ "_resolution": {
+ "type": "version",
+ "tag": "v4.2.0",
+ "commit": "add2bdb8a4af2213d993b728805f1f2a5e76deb8"
+ },
+ "_source": "https://github.com/purescript/purescript-console.git",
+ "_target": "^4.2.0",
+ "_originalSource": "purescript-console"
+ },
+ "dependencies": {
+ "purescript-effect": {
+ "endpoint": {
+ "name": "purescript-effect",
+ "source": "purescript-effect",
+ "target": "^2.0.0"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-effect",
+ "pkgMeta": {
+ "name": "purescript-effect",
+ "homepage": "https://github.com/purescript/purescript-effect",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-effect.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "dependencies": {
+ "purescript-prelude": "^4.0.0"
+ },
+ "version": "2.0.1",
+ "_release": "2.0.1",
+ "_resolution": {
+ "type": "version",
+ "tag": "v2.0.1",
+ "commit": "d2a11e69abcda3b81c750e86e8746cda278f47bf"
+ },
+ "_source": "https://github.com/purescript/purescript-effect.git",
+ "_target": "^2.0.1",
+ "_originalSource": "purescript-effect"
+ },
+ "dependencies": {
+ "purescript-prelude": {
+ "endpoint": {
+ "name": "purescript-prelude",
+ "source": "purescript-prelude",
+ "target": "^4.0.0"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-prelude",
+ "pkgMeta": {
+ "name": "purescript-prelude",
+ "homepage": "https://github.com/purescript/purescript-prelude",
+ "description": "The PureScript Prelude",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-prelude.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "version": "4.1.0",
+ "_release": "4.1.0",
+ "_resolution": {
+ "type": "version",
+ "tag": "v4.1.0",
+ "commit": "7a691ce2658bd8eaf28439391e29506dd154fb3d"
+ },
+ "_source": "https://github.com/purescript/purescript-prelude.git",
+ "_target": "^4.1.0",
+ "_originalSource": "purescript-prelude"
+ },
+ "dependencies": {},
+ "nrDependants": 1
+ }
+ },
+ "nrDependants": 1
+ },
+ "purescript-prelude": {
+ "endpoint": {
+ "name": "purescript-prelude",
+ "source": "purescript-prelude",
+ "target": "^4.0.0"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-prelude",
+ "pkgMeta": {
+ "name": "purescript-prelude",
+ "homepage": "https://github.com/purescript/purescript-prelude",
+ "description": "The PureScript Prelude",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-prelude.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "version": "4.1.0",
+ "_release": "4.1.0",
+ "_resolution": {
+ "type": "version",
+ "tag": "v4.1.0",
+ "commit": "7a691ce2658bd8eaf28439391e29506dd154fb3d"
+ },
+ "_source": "https://github.com/purescript/purescript-prelude.git",
+ "_target": "^4.1.0",
+ "_originalSource": "purescript-prelude"
+ },
+ "dependencies": {},
+ "nrDependants": 1
+ }
+ },
+ "nrDependants": 1
+ },
+ "purescript-effect": {
+ "endpoint": {
+ "name": "purescript-effect",
+ "source": "purescript-effect",
+ "target": "^2.0.0"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-effect",
+ "pkgMeta": {
+ "name": "purescript-effect",
+ "homepage": "https://github.com/purescript/purescript-effect",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-effect.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "dependencies": {
+ "purescript-prelude": "^4.0.0"
+ },
+ "version": "2.0.1",
+ "_release": "2.0.1",
+ "_resolution": {
+ "type": "version",
+ "tag": "v2.0.1",
+ "commit": "d2a11e69abcda3b81c750e86e8746cda278f47bf"
+ },
+ "_source": "https://github.com/purescript/purescript-effect.git",
+ "_target": "^2.0.1",
+ "_originalSource": "purescript-effect"
+ },
+ "dependencies": {},
+ "nrDependants": 1
+ },
+ "purescript-prelude": {
+ "endpoint": {
+ "name": "purescript-prelude",
+ "source": "purescript-prelude",
+ "target": "^4.0.0"
+ },
+ "canonicalDir": "../../../support/bower_components/purescript-prelude",
+ "pkgMeta": {
+ "name": "purescript-prelude",
+ "homepage": "https://github.com/purescript/purescript-prelude",
+ "description": "The PureScript Prelude",
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/purescript/purescript-prelude.git"
+ },
+ "ignore": [
+ "**/.*",
+ "bower_components",
+ "node_modules",
+ "output",
+ "test",
+ "bower.json",
+ "package.json"
+ ],
+ "version": "4.1.0",
+ "_release": "4.1.0",
+ "_resolution": {
+ "type": "version",
+ "tag": "v4.1.0",
+ "commit": "7a691ce2658bd8eaf28439391e29506dd154fb3d"
+ },
+ "_source": "https://github.com/purescript/purescript-prelude.git",
+ "_target": "^4.1.0",
+ "_originalSource": "purescript-prelude"
+ },
+ "dependencies": {},
+ "nrDependants": 1
+ }
+ },
+ "nrDependants": 1
+ }
+ },
+ "nrDependants": 0
+}
diff --git a/tests/purs/publish/basic-example/resolutions.json b/tests/purs/publish/basic-example/resolutions.json
new file mode 100644
index 0000000..2e92161
--- /dev/null
+++ b/tests/purs/publish/basic-example/resolutions.json
@@ -0,0 +1,17 @@
+{
+ "purescript-console": {
+ "version": "1.0.0",
+ "path": "../../../support/bower_components/purescript-console"
+ },
+ "purescript-effect": {
+ "version": "1.0.0",
+ "path": "../../../support/bower_components/purescript-effect"
+ },
+ "purescript-prelude": {
+ "version": "1.0.0",
+ "path": "../../../support/bower_components/purescript-prelude"
+ },
+ "purescript-newtype": {
+ "path": "../../../support/bower_components/purescript-newtype"
+ }
+}
diff --git a/tests/purs/publish/basic-example/src/Main.purs b/tests/purs/publish/basic-example/src/Main.purs
new file mode 100644
index 0000000..085a2dd
--- /dev/null
+++ b/tests/purs/publish/basic-example/src/Main.purs
@@ -0,0 +1,16 @@
+module Main where
+
+import Prelude
+import Effect (Effect)
+import Effect.Console (log)
+import Data.Newtype (class Newtype, un)
+
+newtype Target = Target String
+
+derive instance newtypeTarget :: Newtype Target _
+
+greetingTarget :: Target
+greetingTarget = Target "world"
+
+main :: Effect Unit
+main = log ("hello, " <> un Target greetingTarget <> "!")
diff --git a/tests/support/package-lock.json b/tests/support/package-lock.json
index 1f41aea..c98e1d8 100644
--- a/tests/support/package-lock.json
+++ b/tests/support/package-lock.json
@@ -8,9 +8,9 @@
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"bower": {
- "version": "1.8.4",
- "resolved": "http://registry.npmjs.org/bower/-/bower-1.8.4.tgz",
- "integrity": "sha1-54dqB23rgTf30GUl3F6MZtuC8oo="
+ "version": "1.8.8",
+ "resolved": "https://registry.npmjs.org/bower/-/bower-1.8.8.tgz",
+ "integrity": "sha512-1SrJnXnkP9soITHptSO+ahx3QKp3cVzn8poI6ujqc5SeOkg5iqM1pK9H+DSc2OQ8SnO0jC/NG4Ur/UIwy7574A=="
},
"brace-expansion": {
"version": "1.1.11",
@@ -75,15 +75,15 @@
},
"path-is-absolute": {
"version": "1.0.1",
- "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
},
"rimraf": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
- "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
+ "version": "2.6.3",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
+ "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
"requires": {
- "glob": "^7.0.5"
+ "glob": "^7.1.3"
},
"dependencies": {
"glob": {
diff --git a/tests/support/package.json b/tests/support/package.json
index 18aa9a7..0e54c5e 100644
--- a/tests/support/package.json
+++ b/tests/support/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"dependencies": {
- "bower": "^1.4.1",
+ "bower": "^1.8.8",
"glob": "^5.0.14",
"rimraf": "^2.5.2"
}
diff --git a/tests/support/prelude-resolutions.json b/tests/support/prelude-resolutions.json
index a5704c4..0967ef4 100644
--- a/tests/support/prelude-resolutions.json
+++ b/tests/support/prelude-resolutions.json
@@ -1,7 +1 @@
-{
- "canonicalDir": "bower_components/purescript-prelude",
- "pkgMeta": {
- "dependencies": {}
- },
- "dependencies": {}
-}
+{}
diff --git a/tests/support/pscide/src/CompletionSpecDocs.purs b/tests/support/pscide/src/CompletionSpecDocs.purs
index 1c92a37..dae3fc4 100644
--- a/tests/support/pscide/src/CompletionSpecDocs.purs
+++ b/tests/support/pscide/src/CompletionSpecDocs.purs
@@ -1,3 +1,4 @@
+-- | Module Documentation
module CompletionSpecDocs where
-- | Doc x