File tree Expand file tree Collapse file tree 3 files changed +79
-0
lines changed Expand file tree Collapse file tree 3 files changed +79
-0
lines changed Original file line number Diff line number Diff line change
1
+ module Registry.App.CLI.PursVersions where
2
+
3
+ import Registry.App.Prelude
4
+
5
+ import Data.Array as Array
6
+ import Data.Array.NonEmpty as NEA
7
+ import Data.String as String
8
+ import Node.Library.Execa as Execa
9
+ import Registry.Version as Version
10
+ import Run (AFF , Run )
11
+ import Run as Run
12
+ import Run.Except (EXCEPT )
13
+ import Run.Except as Except
14
+
15
+ pursVersions :: forall r . Run (EXCEPT String + AFF + r ) (NonEmptyArray Version )
16
+ pursVersions = do
17
+ result <- Run .liftAff $ _.result =<< Execa .execa " purs-versions" [] identity
18
+ { stdout } <- Except .rethrow $ lmap (\{ stdout, stderr } -> stdout <> stderr) result
19
+ let { fail, success } = partitionEithers $ map Version .parse (String .split (String.Pattern " " ) stdout)
20
+
21
+ when (Array .length fail > 0 ) do
22
+ Except .throw (String .joinWith " , " fail)
23
+
24
+ case NEA .fromArray success of
25
+ Nothing -> Except .throw " No purs versions"
26
+ Just arr -> pure arr
Original file line number Diff line number Diff line change
1
+ module Test.Registry.App.CLI.PursVersions (spec ) where
2
+
3
+ import Registry.App.Prelude
4
+
5
+ import Data.Array as Array
6
+ import Data.Array.NonEmpty as NEA
7
+ import Registry.App.CLI.PursVersions (pursVersions )
8
+ import Registry.Test.Assert as Assert
9
+ import Registry.Test.Assert.Run as Test.Run
10
+ import Registry.Version as Version
11
+ import Test.Spec as Spec
12
+
13
+ -- NOTE: This should be kept up to date as new versions of the compiler are released.
14
+ -- Upon release of a new compiler version and update of `purescript-overlay`, the tests below will fail until the version is added here.
15
+ knownCompilers :: Array Version
16
+ knownCompilers = map (unsafeFromRight <<< Version .parse)
17
+ [ " 0.13.0"
18
+ , " 0.13.2"
19
+ , " 0.13.3"
20
+ , " 0.13.4"
21
+ , " 0.13.5"
22
+ , " 0.13.6"
23
+ , " 0.13.8"
24
+ , " 0.14.0"
25
+ , " 0.14.1"
26
+ , " 0.14.2"
27
+ , " 0.14.3"
28
+ , " 0.14.4"
29
+ , " 0.14.5"
30
+ , " 0.14.6"
31
+ , " 0.14.7"
32
+ , " 0.14.8"
33
+ , " 0.14.9"
34
+ , " 0.15.0"
35
+ , " 0.15.2"
36
+ , " 0.15.3"
37
+ , " 0.15.4"
38
+ , " 0.15.5"
39
+ , " 0.15.6"
40
+ , " 0.15.7"
41
+ , " 0.15.8"
42
+ , " 0.15.9"
43
+ , " 0.15.10"
44
+ ]
45
+
46
+ spec :: Spec.Spec Unit
47
+ spec = do
48
+ Spec .it " All expected versions are present in purs-version" do
49
+ versionsNonEmpty <- Test.Run .runBaseEffects pursVersions
50
+ let versions = NEA .toArray versionsNonEmpty
51
+ Array .sort versions `Assert.shouldEqual` Array .sort knownCompilers
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import Test.Registry.App.API as Test.API
7
7
import Test.Registry.App.Auth as Test.Auth
8
8
import Test.Registry.App.CLI.Licensee as Test.CLI.Licensee
9
9
import Test.Registry.App.CLI.Purs as Test.CLI.Purs
10
+ import Test.Registry.App.CLI.PursVersions as Test.CLI.PursVersions
10
11
import Test.Registry.App.CLI.Tar as Test.CLI.Tar
11
12
import Test.Registry.App.Effect.PackageSets as Test.Effect.PackageSets
12
13
import Test.Registry.App.GitHubIssue as Test.GitHubIssue
@@ -24,6 +25,7 @@ main = launchAff_ $ runSpec' (defaultConfig { timeout = Just $ Milliseconds 10_0
24
25
Spec .describe " Licensee" Test.CLI.Licensee .spec
25
26
Spec .describe " Tar" Test.CLI.Tar .spec
26
27
Spec .describe " Purs" Test.CLI.Purs .spec
28
+ Spec .describe " PursVersions" Test.CLI.PursVersions .spec
27
29
28
30
Spec .describe " Registry.App.Effect" do
29
31
Test.Effect.PackageSets .spec
You can’t perform that action at this time.
0 commit comments