File: LightSpec.hs

package info (click to toggle)
haskell-utf8-light 0.4.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 108 kB
  • sloc: haskell: 445; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 409 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Codec.Binary.UTF8.LightSpec where

import Test.Hspec

import Codec.Binary.UTF8.Light


main :: IO ()
main = hspec spec


spec :: Spec
spec = do

    describe "encodeUTF8'" $ do
      it "encodes UTF-8" $
        encodeUTF8' [9212 :: Word32] `shouldBe` [[226,143,188] :: [Word8]]
      it "drops Word32 representing invalid UTF-8" $
        encodeUTF8' [921234567 :: Word32] `shouldBe` [[] :: [Word8]]