Created
December 30, 2016 23:14
-
-
Save hdgarrood/bee8bd41f59576aaf3b9ae88dbd4b946 to your computer and use it in GitHub Desktop.
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
[33ma9d20f4[m Add test for generic deriving with awkward records [31m(Harry Garrood, 54 seconds ago)[m | |
diff --git a/examples/passing/RecordLabels.purs b/examples/passing/RecordLabels.purs | |
new file mode 100644 | |
index 0000000..b58a4bd | |
--- /dev/null | |
+++ b/examples/passing/RecordLabels.purs | |
@@ -0,0 +1,5 @@ | |
+module Main where | |
+ | |
+import RecordLabels as RecordLabels | |
+ | |
+main = RecordLabels.main | |
diff --git a/examples/passing/RecordLabels/RecordLabels.purs b/examples/passing/RecordLabels/RecordLabels.purs | |
new file mode 100644 | |
index 0000000..c3716db | |
--- /dev/null | |
+++ b/examples/passing/RecordLabels/RecordLabels.purs | |
@@ -0,0 +1,25 @@ | |
+module RecordLabels where | |
+ | |
+import Prelude | |
+import Data.Generic (class Generic, gShow) | |
+import Control.Monad.Eff.Console (log) | |
+import Test.Assert (assert') | |
+ | |
+newtype AstralKeys = AstralKeys { "💡" :: Int, "💢" :: Int } | |
+newtype LoneSurrogateKeys = LoneSurrogateKeys { "\xdf06" :: Int, "\xd834" :: Int } | |
+ | |
+derive instance genericAstralKeys :: Generic AstralKeys | |
+derive instance genericLoneSurrogateKeys :: Generic LoneSurrogateKeys | |
+ | |
+loneSurrogateKeys = | |
+ gShow (LoneSurrogateKeys { "\xdf06": 0, "\xd834": 1 }) == | |
+ """LoneSurrogateKeys { "\xdf06": 0, "\xd834": 1 }""" | |
+ | |
+astralKeys = | |
+ gShow (AstralKeys { "💡": 0, "💢": 1 }) == | |
+ """AstralKeys { "💡": 0, "💢": 1 }""" | |
+ | |
+main = do | |
+ assert' "lone surrogate keys" loneSurrogateKeys | |
+ assert' "astral keys" astralKeys | |
+ log "Done" | |
diff --git a/tests/support/bower.json b/tests/support/bower.json | |
index c6a7173..aef7751 100644 | |
--- a/tests/support/bower.json | |
+++ b/tests/support/bower.json | |
@@ -9,6 +9,7 @@ | |
"purescript-st": "2.0.0", | |
"purescript-partial": "1.1.2", | |
"purescript-newtype": "1.1.0", | |
+ "purescript-generics": "3.3.0", | |
"purescript-generics-rep": "4.0.0", | |
"purescript-symbols": "^2.0.0", | |
"purescript-typelevel-prelude": "https://github.com/purescript/purescript-typelevel-prelude.git#29a7123a0c29c85d4b923fcf4a7df8e45ebf9bac", |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment