File tree Expand file tree Collapse file tree 1 file changed +12
-20
lines changed Expand file tree Collapse file tree 1 file changed +12
-20
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ module Test.Main where
22
33import Prelude
44
5+ import Data.Either (Either (..))
56import Node.Buffer as Buffer
67import Node.Encoding
78import Node.Stream
@@ -37,7 +38,7 @@ main = do
3738 testSetEncoding
3839
3940testString :: String
40- testString = " Liebe Grüße \n Bergentrückung \n 💡"
41+ testString = " üöß 💡"
4142
4243testSetDefaultEncoding = do
4344 w1 <- writableStreamBuffer
@@ -54,28 +55,19 @@ testSetDefaultEncoding = do
5455 assertEqual testString c
5556
5657testSetEncoding = do
57- check readableStreamBuffer
58-
59- check do
60- r2 <- readableStreamBuffer
61- setEncoding r2 UTF8
62- pure r2
63-
64- check do
65- r3 <- readableStreamBuffer
66- setEncoding r3 UCS2
67- pure r3
68-
58+ check UTF8
59+ check UTF16LE
60+ check UCS2
6961 where
70- check makeR = do
71- r1 <- makeR
72- put testString UTF8 r1
62+ check enc = do
63+ r1 <- readableStreamBuffer
64+ put testString enc r1
7365
74- r2 <- makeR
75- put testString UTF8 r2
66+ r2 <- readableStreamBuffer
67+ put testString enc r2
68+ setEncoding r2 enc
7669
7770 onData r1 \buf -> do
78- onDataString r2 UTF8 \ str -> do
71+ onDataEither r2 \( Left str) -> do
7972 assertEqual <$> Buffer .toString UTF8 buf <*> pure testString
8073 assertEqual str testString
81- log " ok."
You can’t perform that action at this time.
0 commit comments