Skip to content

Commit

Permalink
Refactor monorepo tests to use fixtures (#1197)
Browse files Browse the repository at this point in the history
  • Loading branch information
f-f authored Mar 11, 2024
1 parent 5df0296 commit fdaa7e6
Show file tree
Hide file tree
Showing 91 changed files with 1,004 additions and 507 deletions.
11 changes: 11 additions & 0 deletions test-fixtures/monorepo/1161-regression/package-b/spago.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package:
name: package-b
dependencies:
- either
- prelude
test:
main: Test.PACKAGE.B
dependencies:
- console
- effect
- prelude
10 changes: 10 additions & 0 deletions test-fixtures/monorepo/1161-regression/package-b/src/Main.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Src.PACKAGE.B where

import Prelude
import Data.Either

libraryUsage :: String
libraryUsage = packageNameValue <> EITHER.packageNameValue

packageNameValue :: String
packageNameValue = "package name " <> "package-b"
12 changes: 12 additions & 0 deletions test-fixtures/monorepo/1161-regression/package-b/test/Main.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Test.PACKAGE.B where

import Prelude

import Effect (Effect)
import Effect.Console (log)
import Src.PACKAGE.B as PACKAGE.B
import Data.Either

main :: Effect Unit
main = do
log $ "Test for " <> PACKAGE.B.packageNameValue <> EITHER.packageNameValue
18 changes: 18 additions & 0 deletions test-fixtures/monorepo/1161-regression/spago.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package:
name: root
dependencies: []
test:
main: Test.Main
dependencies: []
workspace:
package_set:
registry: 20.0.1
extra_packages:
either:
git: https://github.com/purescript/purescript-either.git
ref: af655a04ed2fd694b6688af39ee20d7907ad0763
dependencies:
- control
- invariant
- maybe
- prelude
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package:
name: package-a
dependencies:
- prelude
test:
main: Test.PACKAGE.A
dependencies:
- console
- effect
- prelude
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Src.PACKAGE.A where

import Prelude

libraryUsage :: String
libraryUsage = packageNameValue <> "no deps"

packageNameValue :: String
packageNameValue = "package name " <> "package-a"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Test.PACKAGE.A where

import Prelude

import Effect (Effect)
import Effect.Console (log)
import Src.PACKAGE.A as PACKAGE.A

main :: Effect Unit
main = do
log $ "Test for " <> PACKAGE.A.packageNameValue <> "no deps"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package:
name: package-b
dependencies:
- prelude
test:
main: Test.PACKAGE.B
dependencies:
- console
- effect
- prelude
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Src.PACKAGE.B where

import Prelude

libraryUsage :: String
libraryUsage = packageNameValue <> "no deps"

packageNameValue :: String
packageNameValue = "package name " <> "package-b"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Test.PACKAGE.B where

import Prelude

import Effect (Effect)
import Effect.Console (log)
import Src.PACKAGE.B as PACKAGE.B

main :: Effect Unit
main = do
log $ "Test for " <> PACKAGE.B.packageNameValue <> "no deps"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package:
name: package-c
dependencies:
- prelude
test:
main: Test.PACKAGE.C
dependencies:
- console
- effect
- prelude
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Src.PACKAGE.C where

import Prelude

libraryUsage :: String
libraryUsage = packageNameValue <> "no deps"

packageNameValue :: String
packageNameValue = "package name " <> "package-c"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Test.PACKAGE.C where

import Prelude

import Effect (Effect)
import Effect.Console (log)
import Src.PACKAGE.C as PACKAGE.C

main :: Effect Unit
main = do
log $ "Test for " <> PACKAGE.C.packageNameValue <> "no deps"
4 changes: 4 additions & 0 deletions test-fixtures/monorepo/case1-independent-packages/spago.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
workspace:
package_set:
registry: 0.0.1
extra_packages: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package:
name: package-a
dependencies:
- package-shared
- prelude
test:
main: Test.PACKAGE.A
dependencies:
- console
- effect
- prelude
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Src.PACKAGE.A where

import Prelude
import Src.PACKAGE.SHARED as PACKAGE.SHARED

libraryUsage :: String
libraryUsage = packageNameValue <> PACKAGE.SHARED.packageNameValue

packageNameValue :: String
packageNameValue = "package name " <> "package-a"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Test.PACKAGE.A where

import Prelude

import Effect (Effect)
import Effect.Console (log)
import Src.PACKAGE.A as PACKAGE.A
import Src.PACKAGE.SHARED as PACKAGE.SHARED

main :: Effect Unit
main = do
log $ "Test for " <> PACKAGE.A.packageNameValue <> PACKAGE.SHARED.packageNameValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package:
name: package-b
dependencies:
- package-shared
- prelude
test:
main: Test.PACKAGE.B
dependencies:
- console
- effect
- prelude
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Src.PACKAGE.B where

import Prelude
import Src.PACKAGE.SHARED as PACKAGE.SHARED

libraryUsage :: String
libraryUsage = packageNameValue <> PACKAGE.SHARED.packageNameValue

packageNameValue :: String
packageNameValue = "package name " <> "package-b"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Test.PACKAGE.B where

import Prelude

import Effect (Effect)
import Effect.Console (log)
import Src.PACKAGE.B as PACKAGE.B
import Src.PACKAGE.SHARED as PACKAGE.SHARED

main :: Effect Unit
main = do
log $ "Test for " <> PACKAGE.B.packageNameValue <> PACKAGE.SHARED.packageNameValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package:
name: package-shared
dependencies:
- prelude
test:
main: Test.PACKAGE.SHARED
dependencies:
- console
- effect
- prelude
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Src.PACKAGE.SHARED where

import Prelude

libraryUsage :: String
libraryUsage = packageNameValue <> "no deps"

packageNameValue :: String
packageNameValue = "package name " <> "package-shared"
4 changes: 4 additions & 0 deletions test-fixtures/monorepo/case2-shared-dependencies1/spago.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
workspace:
package_set:
registry: 0.0.1
extra_packages: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package:
name: package-a
dependencies:
- package-b
- package-c
- prelude
test:
main: Test.PACKAGE.A
dependencies:
- console
- effect
- prelude
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Src.PACKAGE.A where

import Prelude
import Src.PACKAGE.C as PACKAGE.C
import Src.PACKAGE.B as PACKAGE.B

libraryUsage :: String
libraryUsage = packageNameValue <> PACKAGE.C.packageNameValue <> PACKAGE.B.packageNameValue

packageNameValue :: String
packageNameValue = "package name " <> "package-a"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module Test.PACKAGE.A where

import Prelude

import Effect (Effect)
import Effect.Console (log)
import Src.PACKAGE.A as PACKAGE.A
import Src.PACKAGE.C as PACKAGE.C
import Src.PACKAGE.B as PACKAGE.B

main :: Effect Unit
main = do
log $ "Test for " <> PACKAGE.A.packageNameValue <> PACKAGE.C.packageNameValue <> PACKAGE.B.packageNameValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package:
name: package-b
dependencies:
- package-c
- prelude
test:
main: Test.PACKAGE.B
dependencies:
- console
- effect
- prelude
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Src.PACKAGE.B where

import Prelude
import Src.PACKAGE.C as PACKAGE.C

libraryUsage :: String
libraryUsage = packageNameValue <> PACKAGE.C.packageNameValue

packageNameValue :: String
packageNameValue = "package name " <> "package-b"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Test.PACKAGE.B where

import Prelude

import Effect (Effect)
import Effect.Console (log)
import Src.PACKAGE.B as PACKAGE.B
import Src.PACKAGE.C as PACKAGE.C

main :: Effect Unit
main = do
log $ "Test for " <> PACKAGE.B.packageNameValue <> PACKAGE.C.packageNameValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package:
name: package-c
dependencies:
- prelude
test:
main: Test.PACKAGE.C
dependencies:
- console
- effect
- prelude
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Src.PACKAGE.C where

import Prelude

libraryUsage :: String
libraryUsage = packageNameValue <> "no deps"

packageNameValue :: String
packageNameValue = "package name " <> "package-c"
4 changes: 4 additions & 0 deletions test-fixtures/monorepo/case3-shared-dependencies2/spago.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
workspace:
package_set:
registry: 0.0.1
extra_packages: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package:
name: non-root-package-a
dependencies:
- prelude
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Subpackage.NON.ROOT.PACKAGE.A where

import Prelude

packageName :: String
packageName = "package" <> "non-root-package-a"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package:
name: non-root-package-b
dependencies:
- prelude
Loading

0 comments on commit fdaa7e6

Please sign in to comment.