fix(csv): less quoting in semicolon separated lists
This commit is contained in:
parent
fe8e4bbd4f
commit
42f1eabb2c
@ -140,7 +140,9 @@ instance ToField a => ToField (CsvSemicolonList a) where
|
|||||||
fs = map toField xs
|
fs = map toField xs
|
||||||
encOpts = defaultEncodeOptions
|
encOpts = defaultEncodeOptions
|
||||||
{ encDelimiter = fromIntegral $ ord ';'
|
{ encDelimiter = fromIntegral $ ord ';'
|
||||||
, encQuoting = bool QuoteMinimal QuoteAll $ all null fs
|
, encQuoting = case fs of
|
||||||
|
[fStr] | null fStr -> QuoteAll
|
||||||
|
_other -> QuoteMinimal
|
||||||
, encUseCrLf = True
|
, encUseCrLf = True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ spec = modifyMaxSuccess (* 10) . parallel $ do
|
|||||||
test ["foo", "bar"] "foo;bar"
|
test ["foo", "bar"] "foo;bar"
|
||||||
test [] ""
|
test [] ""
|
||||||
test [""] "\"\""
|
test [""] "\"\""
|
||||||
test ["", ""] "\"\";\"\""
|
test ["", ""] ";"
|
||||||
test ["foo", ""] "foo;"
|
test ["foo", ""] "foo;"
|
||||||
test ["", "foo"] ";foo"
|
test ["", "foo"] ";foo"
|
||||||
test ["", "", "foo", ""] ";;foo;"
|
test ["", "", "foo", ""] ";;foo;"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user