@@ -1,18 +1,26 @@
11module Main where
22
3−import Prelude ((==), bind)
4−import Test.Assert (assert)
3+import Prelude ((==), (/=), (<>), bind)
4+import Test.Assert (assert, assert')
55import Control.Monad.Eff.Console (log)
66
77singleCharacter = "\0\b\t\n\v\f\r\"\\" == "\x0\x8\x9\xA\xB\xC\xD\x22\x5C"
88hex = "\x1D306\x2603\x3C6\xE0\x0" == "𝌆☃φà\0"
99decimal = "\119558\9731\966\224\0" == "𝌆☃φà\0"
1010surrogatePair = "\xD834\xDF06" == "\x1D306"
11+highSurrogate = "\xD834"
12+lowSurrogate = "\xDF06"
13+loneSurrogates = (highSurrogate <> lowSurrogate) == "\x1D306"
14+outOfOrderSurrogates = (lowSurrogate <> highSurrogate) == "\xDF06\xD834"
15+replacement = "\xFFFD"
16+notReplacing = replacement /= highSurrogate
1117
1218main = do
13− assert singleCharacter
14− assert hex
15− assert decimal
16−-- TODO: Broken in #2418 should be fixed after #2434 is fixed
17−-- assert surrogatePair
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
1826 log "Done"