about summary refs log tree commit diff
path: root/third_party/bazel/rules_haskell/tests/hsc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/bazel/rules_haskell/tests/hsc')
-rw-r--r--third_party/bazel/rules_haskell/tests/hsc/BUILD.bazel35
-rw-r--r--third_party/bazel/rules_haskell/tests/hsc/Bar.hsc6
-rw-r--r--third_party/bazel/rules_haskell/tests/hsc/Bar/Baz.hsc6
-rw-r--r--third_party/bazel/rules_haskell/tests/hsc/BinHsc.hsc1
-rw-r--r--third_party/bazel/rules_haskell/tests/hsc/Flags.hsc8
-rw-r--r--third_party/bazel/rules_haskell/tests/hsc/Foo.hsc8
-rw-r--r--third_party/bazel/rules_haskell/tests/hsc/Main.hs10
7 files changed, 74 insertions, 0 deletions
diff --git a/third_party/bazel/rules_haskell/tests/hsc/BUILD.bazel b/third_party/bazel/rules_haskell/tests/hsc/BUILD.bazel
new file mode 100644
index 000000000000..1e9a07cd5e08
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hsc/BUILD.bazel
@@ -0,0 +1,35 @@
+load(
+    "@io_tweag_rules_haskell//haskell:haskell.bzl",
+    "haskell_library",
+    "haskell_test",
+)
+
+package(default_testonly = 1)
+
+haskell_library(
+    name = "hsc-lib",
+    srcs = [
+        "Bar.hsc",
+        "Bar/Baz.hsc",
+        "Flags.hsc",
+        "Foo.hsc",
+    ],
+    compiler_flags = [
+        "-DTHIS_IS_TRUE",
+        "-optP-DTHIS_TOO_IS_TRUE",
+    ],
+    deps = ["//tests/hackage:base"],
+)
+
+haskell_test(
+    name = "hsc",
+    srcs = [
+        "BinHsc.hsc",
+        "Main.hs",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        ":hsc-lib",
+        "//tests/hackage:base",
+    ],
+)
diff --git a/third_party/bazel/rules_haskell/tests/hsc/Bar.hsc b/third_party/bazel/rules_haskell/tests/hsc/Bar.hsc
new file mode 100644
index 000000000000..a8bb791513b5
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hsc/Bar.hsc
@@ -0,0 +1,6 @@
+module Bar (hscFiredBar) where
+
+#ifndef _INTERNAL_HSC_DO_NOT_DEFINE_ME
+hscFiredBar :: String
+hscFiredBar = "hscFiredBar"
+#endif
diff --git a/third_party/bazel/rules_haskell/tests/hsc/Bar/Baz.hsc b/third_party/bazel/rules_haskell/tests/hsc/Bar/Baz.hsc
new file mode 100644
index 000000000000..7db172485de5
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hsc/Bar/Baz.hsc
@@ -0,0 +1,6 @@
+module Bar.Baz (hscFiredBaz) where
+
+#ifndef _INTERNAL_HSC_DO_NOT_DEFINE_ME
+hscFiredBaz :: String
+hscFiredBaz = "hscFiredBaz"
+#endif
diff --git a/third_party/bazel/rules_haskell/tests/hsc/BinHsc.hsc b/third_party/bazel/rules_haskell/tests/hsc/BinHsc.hsc
new file mode 100644
index 000000000000..ddfee79c137c
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hsc/BinHsc.hsc
@@ -0,0 +1 @@
+module BinHsc () where
\ No newline at end of file
diff --git a/third_party/bazel/rules_haskell/tests/hsc/Flags.hsc b/third_party/bazel/rules_haskell/tests/hsc/Flags.hsc
new file mode 100644
index 000000000000..b090df576ab4
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hsc/Flags.hsc
@@ -0,0 +1,8 @@
+module Flags (hscFlags) where
+
+#ifdef THIS_IS_TRUE
+#ifdef THIS_TOO_IS_TRUE
+hscFlags :: String
+hscFlags = "hscFlags"
+#endif
+#endif
diff --git a/third_party/bazel/rules_haskell/tests/hsc/Foo.hsc b/third_party/bazel/rules_haskell/tests/hsc/Foo.hsc
new file mode 100644
index 000000000000..2cb726e18110
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hsc/Foo.hsc
@@ -0,0 +1,8 @@
+module Foo (hscFiredFoo) where
+
+#if __GLASGOW_HASKELL__ >= 700
+#ifndef _INTERNAL_HSC_DO_NOT_DEFINE_ME
+hscFiredFoo :: String
+hscFiredFoo = "hscFiredFoo"
+#endif
+#endif
diff --git a/third_party/bazel/rules_haskell/tests/hsc/Main.hs b/third_party/bazel/rules_haskell/tests/hsc/Main.hs
new file mode 100644
index 000000000000..33ff7f10f78c
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hsc/Main.hs
@@ -0,0 +1,10 @@
+module Main (main) where
+
+import BinHsc ()
+import Foo (hscFiredFoo)
+import Bar (hscFiredBar)
+import Bar.Baz (hscFiredBaz)
+import Flags (hscFlags)
+
+main :: IO ()
+main = putStrLn (hscFiredFoo ++ hscFiredBar ++ hscFiredBaz ++ hscFlags)