implemented encodeRows
This commit is contained in:
@@ -33,6 +33,7 @@ import Data.CSV.Sip
|
||||
|
||||
spec :: Spec
|
||||
spec = describe "Data.CSV.Sip" $ do
|
||||
encodeRowsSpec
|
||||
encodeRawRowsSpec
|
||||
labelFieldsSpec
|
||||
decodeRowsSpec
|
||||
@@ -40,6 +41,24 @@ spec = describe "Data.CSV.Sip" $ do
|
||||
decodeUTF8Spec
|
||||
toBytesSpec
|
||||
|
||||
encodeRowsSpec :: Spec
|
||||
encodeRowsSpec = describe "encodeRows" $ do
|
||||
result <- BS.concat <$> runConduit
|
||||
(sourceList input .| encodeRows .| consume)
|
||||
it ("shouldBe " ++ show expected) $
|
||||
result `shouldBe` expected
|
||||
where
|
||||
|
||||
input =
|
||||
[ [ "foo", "a\"b" ]
|
||||
, [ "a\rb", "a\nb" ]
|
||||
]
|
||||
|
||||
expected = BS.concat
|
||||
[ "\"foo\",\"a\"\"b\"\r\n"
|
||||
, "\"a\rb\",\"a\nb\"\r\n"
|
||||
]
|
||||
|
||||
encodeRawRowsSpec :: Spec
|
||||
encodeRawRowsSpec = describe "encodeRawRows" $ do
|
||||
result <- BS.concat <$> runConduit
|
||||
|
||||
Reference in New Issue
Block a user