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
2
2
3
3
import Prelude
4
4
5
+ import Data.Either (Either (..))
5
6
import Node.Buffer as Buffer
6
7
import Node.Encoding
7
8
import Node.Stream
@@ -37,7 +38,7 @@ main = do
37
38
testSetEncoding
38
39
39
40
testString :: String
40
- testString = " Liebe Grüße \n Bergentrückung \n 💡"
41
+ testString = " üöß 💡"
41
42
42
43
testSetDefaultEncoding = do
43
44
w1 <- writableStreamBuffer
@@ -54,28 +55,19 @@ testSetDefaultEncoding = do
54
55
assertEqual testString c
55
56
56
57
testSetEncoding = 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
69
61
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
73
65
74
- r2 <- makeR
75
- put testString UTF8 r2
66
+ r2 <- readableStreamBuffer
67
+ put testString enc r2
68
+ setEncoding r2 enc
76
69
77
70
onData r1 \buf -> do
78
- onDataString r2 UTF8 \ str -> do
71
+ onDataEither r2 \( Left str) -> do
79
72
assertEqual <$> Buffer .toString UTF8 buf <*> pure testString
80
73
assertEqual str testString
81
- log " ok."
You can’t perform that action at this time.
0 commit comments