Skip to content

Commit

Permalink
transitive reexport tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prednaz committed Feb 21, 2024
1 parent 8a3aca4 commit d98672a
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 11 deletions.
11 changes: 8 additions & 3 deletions rules_haskell_tests/tests/RunTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ main = hspec $ around_ printStatsHook $ do
it "loads module with module dependency" $
assertSuccess (Process.proc "./.ghcide" ["tests/binary-with-lib/Main.hs"])

describe "transitive re-exports" $ do
it "work" $
assertSuccess (bazel ["build", "//tests/package-reexport-transitive"])
it "work for long chains" $
assertSuccess (bazel ["build", "//tests/package-reexport-transitive:long"])
it "do not work for interrupted chains" $
assertFailure (bazel ["build", "//tests/package-reexport-transitive:interrupted"])

describe "failures" $ do
-- Make sure not to include haskell_repl (@repl) or alias (-repl) targets
-- in the query. Those would not fail under bazel test.
Expand All @@ -130,9 +138,6 @@ main = hspec $ around_ printStatsHook $ do
it "haskell_doc fails with plugins #1549" $
-- https://github.com/tweag/rules_haskell/issues/1549
assertFailure (bazel ["build", "//tests/haddock-with-plugin"])
it "transitive re-exports do not work #1145" $
-- https://github.com/tweag/rules_haskell/issues/1145
assertFailure (bazel ["build", "//tests/package-reexport-transitive"])
it "doctest failure with foreign import #1559" $
-- https://github.com/tweag/rules_haskell/issues/1559
assertFailure (bazel ["build", "//tests/haskell_doctest_ffi_1559:doctest-a"])
Expand Down
73 changes: 65 additions & 8 deletions rules_haskell_tests/tests/package-reexport-transitive/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,38 @@ haskell_library(

haskell_library(
name = "intermediate",
exports = [
":root",
],
deps = [
":root",
],
exports = [":root"],
deps = [":root"],
)

haskell_library(
name = "intermediate1",
exports = [":intermediate"],
deps = [":intermediate"],
)

haskell_library(
name = "intermediate2",
exports = [":intermediate1"],
deps = [":intermediate1"],
)

haskell_library(
name = "intermediate3",
exports = [":intermediate2"],
deps = [":intermediate2"],
)

haskell_library(
name = "intermediate4",
exports = [],
deps = [":intermediate2"],
)

haskell_library(
name = "intermediate5",
exports = [":intermediate4"],
deps = [":intermediate4"],
)

haskell_library(
Expand All @@ -30,8 +56,6 @@ haskell_library(
],
)

# Failure test for https://github.com/tweag/rules_haskell/issues/1145
# TODO Turn into regression test once that issue is resolved.
haskell_test(
name = "final",
srcs = ["Main.hs"],
Expand All @@ -47,3 +71,36 @@ test_suite(
tags = ["manual"],
tests = [":final"],
)

haskell_test(
name = "final-long",
srcs = ["Main.hs"],
tags = ["manual"],
deps = [
":intermediate3",
"//tests/hackage:base",
],
)

test_suite(
name = "long",
tags = ["manual"],
tests = [":final-long"],
)

haskell_test(
name = "final-interrupted",
srcs = ["Main.hs"],
tags = ["manual"],
deps = [
":intermediate5",
"//tests/hackage:base",
],
)

test_suite(
name = "interrupted",
tags = ["manual"],
tests = [":final-interrupted"],
)

0 comments on commit d98672a

Please sign in to comment.