purescript-0.15.15: tests/purs/passing/StringEdgeCases/Records.purs
module Records where
import Prelude
import Effect.Console (log)
import Test.Assert (assert')
newtype AstralKeys = AstralKeys { "π‘" :: Int, "π’" :: Int }
newtype LoneSurrogateKeys = LoneSurrogateKeys { "\xdf06" :: Int, "\xd834" :: Int }
testLoneSurrogateKeys =
let
expected = 5
actual = (_."\xd801" <<< helper) { "\xd800": 5 }
in
assert' ("lone surrogate keys: " <> show actual) (expected == actual)
where
helper :: { "\xd800" :: Int } -> { "\xd801" :: Int }
helper o =
case o."\xd800" of
x -> { "\xd801": x }
testAstralKeys =
let
expected = 5
actual = (_."π’" <<< helper) { "π‘": 5 }
in
assert' ("astral keys: " <> show actual) (expected == actual)
where
helper :: { "π‘" :: Int } -> { "π’" :: Int }
helper o =
case o."π‘" of
x -> { "π’": x }
main = do
testLoneSurrogateKeys
testAstralKeys
log "Done"