willow-0.1.0.0: test/Test/Willow/WebPlatformTests/Manual/Encoding/Gbk.hs
{-# LANGUAGE OverloadedStrings #-}
{-|
Description: Emulating tests from @encoding/gbk-encoder.html@
Copyright: (c) 2020 Samuel May
License: MPL-2.0
Maintainer: ag.eitilt@gmail.com
Stability: experimental
Portability: portable
-}
module Test.Willow.WebPlatformTests.Manual.Encoding.Gbk
( tests
) where
import qualified Test.HUnit as U
import Test.HUnit ( (~:), (~?=) )
import Web.Willow.Common.Encoding
import Test.Willow.WebPlatformTests.Manual.Common
tests :: U.Test
tests = "gbk-encoder.html" ~: U.TestList $ map test testData
where test t = nameE t ~: encodeEnc' Gbk (inputE t) ~?= outputE t
testData :: [InlineEncode]
testData =
[ InlineEncode
{ inputE = "s"
, outputE = "s"
, nameE = "very basic"
}
, InlineEncode
{ inputE = "\x20AC"
, outputE = "\x80"
, nameE = "Euro"
}
, InlineEncode
{ inputE = "\x4E02"
, outputE = "\x81@"
, nameE = "character"
}
, InlineEncode
{ inputE = "\xE4C6"
, outputE = "\xA1@"
, nameE = "PUA"
}
, InlineEncode
{ inputE = "\xE4C5"
, outputE = "\xFE\xFE"
, nameE = "PUA #2"
}
, InlineEncode
{ inputE = "\x1F4A9"
, outputE = "\x26\x23\&128169\x3B"
, nameE = "poo"
}
]