-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use `rule_test` to verify that a rule a) worked, b) produced the expected output. This obviates the need for a shell script that launches binaries and is more general, so can be used systematically. It's the testing strategy that `rules_rust` uses. We may want to revive launching binaries later, but this is good enough for now. Also, systematically put each test in its own subdir.
- Loading branch information
Showing
27 changed files
with
159 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
load("@io_tweag_rules_haskell//haskell:haskell.bzl", | ||
"haskell_binary", | ||
) | ||
|
||
haskell_binary( | ||
name = "binary-simple", | ||
srcs = ["Main.hs"], | ||
visibility = ["//visibility:public"] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Main where | ||
|
||
main = return () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
load("@io_tweag_rules_haskell//haskell:haskell.bzl", | ||
"haskell_binary", | ||
"haskell_library", | ||
) | ||
|
||
haskell_library( | ||
name = "lib", | ||
srcs = glob(["src/*.hs"]), | ||
sourceDir = "src", | ||
) | ||
|
||
haskell_binary( | ||
name = "binary-with-lib", | ||
srcs = ["Main.hs"], | ||
deps = ["lib"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Main where | ||
|
||
import Lib (value) | ||
|
||
main = print value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
|
||
module Lib (value) where | ||
|
||
value = 42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
load("@io_tweag_rules_haskell//haskell:haskell.bzl", | ||
"haskell_binary", | ||
) | ||
|
||
haskell_binary( | ||
name = "binary-with-main", | ||
srcs = ["MainIsHere.hs"], | ||
main = "MainIsHere.this", | ||
visibility = ["//visibility:public"] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module MainIsHere (this) where | ||
|
||
this :: IO () | ||
this = return () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
load("@io_tweag_rules_haskell//haskell:haskell.bzl", | ||
"haskell_binary", | ||
) | ||
|
||
haskell_binary( | ||
name = "binary-with-prebuilt", | ||
srcs = ["Main.hs"], | ||
prebuilt_dependencies = ["base", "template-haskell"], | ||
visibility = ["//visibility:public"] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Main where | ||
|
||
import Data.List () | ||
import Language.Haskell.TH () | ||
|
||
main = return () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
load( | ||
"@io_tweag_rules_haskell//haskell:haskell.bzl", | ||
"haskell_library", | ||
"haskell_binary", | ||
) | ||
|
||
haskell_library( | ||
name = "hsc-lib", | ||
hscs = ["Test.hsc"], | ||
prebuilt_dependencies = ["base"], | ||
) | ||
|
||
# https://github.com/tweag/rules_haskell/issues/13 | ||
haskell_binary( | ||
name = "hsc", | ||
srcs = ["Main.hs"], | ||
prebuilt_dependencies = ["base"], | ||
deps = [":hsc-lib"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
load( | ||
"@io_tweag_rules_haskell//haskell:haskell.bzl", | ||
"haskell_library", | ||
) | ||
|
||
haskell_library( | ||
name = "library-deps", | ||
srcs = ["TestLib.hs"], | ||
deps = ["//tests/library-deps/sublib"], | ||
prebuilt_dependencies = ["base"], | ||
visibility = ["//visibility:public"], | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
load( | ||
"@io_tweag_rules_haskell//haskell:haskell.bzl", | ||
"haskell_library", | ||
) | ||
|
||
haskell_library( | ||
name = "sublib", | ||
srcs = ["TestSubLib.hs"], | ||
prebuilt_dependencies = ["base"], | ||
visibility = ["//visibility:public"], | ||
) |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module TogetherTest (main) where | ||
module Main where | ||
|
||
import One (one) | ||
import Two (two) | ||
|
File renamed without changes.
File renamed without changes.