-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds phantom handling utilities to the Compiler with tests
- Loading branch information
1 parent
938f167
commit 785d2c6
Showing
9 changed files
with
131 additions
and
21 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 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 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
28 changes: 28 additions & 0 deletions
28
lambda-buffers-compiler/test/Test/LambdaBuffers/Compiler/Phantoms.hs
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,28 @@ | ||
module Test.LambdaBuffers.Compiler.Phantoms (test) where | ||
|
||
import LambdaBuffers.ProtoCompat qualified as PC | ||
import LambdaBuffers.ProtoCompat.Utils (collectPhantomTyArgs) | ||
import Test.LambdaBuffers.ProtoCompat.Utils qualified as U | ||
import Test.Tasty (TestTree, adjustOption, testGroup) | ||
import Test.Tasty.HUnit (testCase, (@?=)) | ||
import Test.Tasty.Hedgehog qualified as H | ||
|
||
test :: TestTree | ||
test = | ||
adjustOption (\_ -> H.HedgehogTestLimit $ Just 1000) $ | ||
testGroup | ||
"Phantoms checks" | ||
[ testCase "phantomA" $ phantoms U.td'phantomA @?= ["a"] | ||
, testCase "phantomB" $ phantoms U.td'phantomB @?= ["a", "b"] | ||
, testCase "phantomC" $ phantoms U.td'phantomC @?= ["a"] | ||
, testCase "phantomD" $ phantoms U.td'phantomD @?= ["a", "b"] | ||
, testCase "phantomE" $ phantoms U.td'phantomE @?= ["a"] | ||
, testCase "phantomF" $ phantoms U.td'phantomF @?= ["a", "b"] | ||
, testCase "Either" $ phantoms U.td'either @?= [] | ||
, testCase "Either opaque" $ phantoms U.td'eitherO @?= [] | ||
, testCase "List" $ phantoms U.td'list @?= [] | ||
, testCase "Maybe" $ phantoms U.td'maybe @?= [] | ||
, testCase "Maybe opaque" $ phantoms U.td'maybeO @?= [] | ||
] | ||
where | ||
phantoms = fmap ((\(PC.VarName name _) -> name) . PC.argName) . collectPhantomTyArgs |
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