git.iko.soy/rowtype-yoga/purescript-native
on da472aa help sign in
26 lines 1.2 kB history raw
1module Main where
3import Prelude ((==), (/=), (<>), bind)
4import Test.Assert (assert, assert')
5import Control.Monad.Eff.Console (log)
7singleCharacter = "\0\b\t\n\v\f\r\"\\" == "\x0\x8\x9\xA\xB\xC\xD\x22\x5C"
8hex = "\x1D306\x2603\x3C6\xE0\x0" == "๐Œ†โ˜ƒฯ†ร \0"
9decimal = "\119558\9731\966\224\0" == "๐Œ†โ˜ƒฯ†ร \0"
10surrogatePair = "\xD834\xDF06" == "\x1D306"
11highSurrogate = "\xD834"
12lowSurrogate = "\xDF06"
13loneSurrogates = (highSurrogate <> lowSurrogate) == "\x1D306"
14outOfOrderSurrogates = (lowSurrogate <> highSurrogate) == "\xDF06\xD834"
15replacement = "\xFFFD"
16notReplacing = replacement /= highSurrogate
18main = do
19 assert' "single-character escape sequences" singleCharacter
20 assert' "hex escape sequences" hex
21 assert' "decimal escape sequences" decimal
22 assert' "astral code points are represented as a UTF-16 surrogate pair" surrogatePair
23 assert' "lone surrogates may be combined into a surrogate pair" loneSurrogates
24 assert' "lone surrogates may be combined out of order to remain lone surrogates" outOfOrderSurrogates
25 -- assert' "lone surrogates are not replaced with the Unicode replacement character U+FFFD" notReplacing
26 log "Done"