From 9ec4d7e9c34a23ef813c89abf401ccdf236454c8 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Thu, 21 Apr 2022 00:02:38 -0400 Subject: [PATCH] extra test in decodeRawRows I needed to make sure that a trailing comma on a row would leave a blank cell at the end of the row. --- test/Data/CSV/SlurpSpec.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/Data/CSV/SlurpSpec.hs b/test/Data/CSV/SlurpSpec.hs index cd29130..0ed9bdf 100644 --- a/test/Data/CSV/SlurpSpec.hs +++ b/test/Data/CSV/SlurpSpec.hs @@ -93,6 +93,7 @@ decodeRawRowsSpec = describe "decodeRawRows" $ mapM_ , ( "odd chunk", oddChunkIn, normalRes ) , ( "no newline", noNewlineIn, normalRes ) , ( "malformed", malformedIn, malformedRes ) + , ( "blank end", blankEndIn, blankEndRes ) ] where @@ -158,6 +159,11 @@ decodeRawRowsSpec = describe "decodeRawRows" $ mapM_ , "baz,quux\r\n" ] + blankEndIn = + [ "foo,bar,\r\n" + , "baz,quux\r\n" + ] + normalRes = [ ["foo", "bar"] , ["baz", "quux"] @@ -188,6 +194,11 @@ decodeRawRowsSpec = describe "decodeRawRows" $ mapM_ , ["baz", "quux"] ] + blankEndRes = + [ ["foo", "bar", ""] + , ["baz", "quux"] + ] + decodeUTF8Spec :: Spec decodeUTF8Spec = describe "decodeUTF8" $ mapM_ ( \(label, input, expected) -> context label $