Skip to content

Commit a71708d

Browse files
committed
Remove some unnecessary type assertions from the tests, and fix testFill
1 parent fec1805 commit a71708d

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

test/Test/Node/Buffer/Mutable.purs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,24 @@ testMutableBuffer _ run = do
7878
where
7979
testCreate :: Effect Unit
8080
testCreate = do
81-
buf <- run ((create 3 :: m buf) >>= toArray)
81+
buf <- run (create 3 >>= toArray)
8282
assertEqual {expected: [0, 0, 0], actual: buf}
8383

8484
testFreeze :: Effect Unit
8585
testFreeze = do
86-
buf <- Buffer.toArray <$> run ((fromArray [1, 2, 3] :: m buf) >>= freeze)
86+
buf <- Buffer.toArray <$> run (fromArray [1, 2, 3] >>= freeze)
8787
assertEqual {expected: [1, 2, 3], actual: buf}
8888

8989
testThaw :: Effect Unit
9090
testThaw = do
91-
buf <- run ((thaw (Buffer.fromArray [1, 2, 3]) :: m buf) >>= toArray)
91+
buf <- run (thaw (Buffer.fromArray [1, 2, 3]) >>= toArray)
9292
assertEqual {expected: [1, 2, 3], actual: buf}
9393

9494
testReadWrite :: Effect Unit
9595
testReadWrite = do
9696
let val = 42
9797
readVal <- run do
98-
buf <- create 1 :: m buf
98+
buf <- create 1
9999
write UInt8 val 0 buf
100100
read UInt8 0 buf
101101

@@ -104,7 +104,7 @@ testMutableBuffer _ run = do
104104
testFromArray :: Effect Unit
105105
testFromArray = do
106106
readVal <- run do
107-
buf <- fromArray [1,2,3,4,5] :: m buf
107+
buf <- fromArray [1,2,3,4,5]
108108
read UInt8 2 buf
109109

110110
assertEqual {expected: 3, actual: readVal}
@@ -113,7 +113,7 @@ testMutableBuffer _ run = do
113113
testToArray = do
114114
let val = [1,2,67,3,3,7,8,3,4,237]
115115
valOut <- run do
116-
buf <- fromArray val :: m buf
116+
buf <- fromArray val
117117
toArray buf
118118

119119
assertEqual {expected: val, actual: valOut}
@@ -122,7 +122,7 @@ testMutableBuffer _ run = do
122122
testFromString = do
123123
let str = "hello, world"
124124
val <- run do
125-
buf <- fromString str ASCII :: m buf
125+
buf <- fromString str ASCII
126126
read UInt8 6 buf
127127

128128
assertEqual {expected: 32, actual: val} -- ASCII space
@@ -140,7 +140,7 @@ testMutableBuffer _ run = do
140140
testToString = do
141141
let str = "hello, world"
142142
strOut <-run do
143-
buf <- fromString str ASCII :: m buf
143+
buf <- fromString str ASCII
144144
toString ASCII buf
145145

146146
assertEqual {expected: str, actual: strOut}
@@ -149,16 +149,16 @@ testMutableBuffer _ run = do
149149
testReadString = do
150150
let str = "hello, world"
151151
strOut <- run do
152-
buf <- fromString str ASCII :: m buf
152+
buf <- fromString str ASCII
153153
readString ASCII 7 12 buf
154154

155155
assertEqual {expected: "world", actual: strOut}
156156

157157
testSlice :: Effect Unit
158158
testSlice = do
159159
{bufArr, bufSliceArr} <- run do
160-
buf <- fromArray [1, 2, 3, 4] :: m buf
161-
let bufSlice = slice 1 3 buf :: buf
160+
buf <- fromArray [1, 2, 3, 4]
161+
let bufSlice = slice 1 3 buf
162162
setAtOffset 42 1 bufSlice
163163
bufArr <- toArray buf
164164
bufSliceArr <- toArray bufSlice
@@ -170,7 +170,7 @@ testMutableBuffer _ run = do
170170
testCopy :: Effect Unit
171171
testCopy = do
172172
{copied, out} <- run do
173-
buf1 <- fromArray [1,2,3,4,5] :: m buf
173+
buf1 <- fromArray [1,2,3,4,5]
174174
buf2 <- fromArray [10,9,8,7,6]
175175
copied <- copy 0 3 buf1 2 buf2
176176
out <- toArray buf2
@@ -181,26 +181,26 @@ testMutableBuffer _ run = do
181181

182182
testFill :: Effect Unit
183183
testFill = do
184-
let out = ST.run do
185-
buf <- fromArray [1,1,1,1,1]
186-
fill 42 2 4 buf
187-
toArray buf
184+
out <- run do
185+
buf <- fromArray [1,1,1,1,1]
186+
fill 42 2 4 buf
187+
toArray buf
188188

189189
assertEqual {expected: [1,1,42,42,1], actual: out}
190190

191191
testConcat' :: Effect Unit
192192
testConcat' = do
193193
out <- run do
194194
bufs <- traverse fromArray $ map (\x -> [x, x+1, x+2]) [0,3,6,9,12]
195-
buf <- concat' bufs 15 :: m buf
195+
buf <- concat' bufs 15
196196
toArray buf
197197

198198
assertEqual {expected: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14], actual: out}
199199

200200
testGetAtOffset :: Effect Unit
201201
testGetAtOffset = do
202202
{o1, o4, om1} <- run do
203-
buf <- fromArray [1, 2, 3, 4] :: m buf
203+
buf <- fromArray [1, 2, 3, 4]
204204
o1 <- getAtOffset 1 buf
205205
o4 <- getAtOffset 4 buf
206206
om1 <- getAtOffset (-1) buf

0 commit comments

Comments
 (0)