Skip to content

Spaces after CSV delimiters are not stripped #811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public void heading_has_no_extra_quotes() {
assertEquals("label", semiColonSeparated.getChildAt(0).getChildAt(0).getName());
}

@Test
public void heading_spaces_are_not_stripped() {
assertEquals(" extra", commaSeparated.getChildAt(0).getChildAt(3).getName());
assertEquals(" extra", semiColonSeparated.getChildAt(0).getChildAt(3).getName());
}

@Test
public void value_has_no_extra_quotes() {
assertEquals("A", commaSeparated.getChildAt(0).getChildAt(0).getValue().getValue());
Expand All @@ -54,6 +60,12 @@ public void missing_fields_replaced_with_spaces() {
}
}

@Test
public void value_spaces_are_not_stripped() {
assertEquals(" b", commaSeparated.getChildAt(8).getChildAt(1).getValue().getValue());
assertEquals(" b", semiColonSeparated.getChildAt(8).getChildAt(1).getValue().getValue());
}

@Test
public void ignores_utf8_bom() throws IOException {
BOMInputStream bomIs = new BOMInputStream(new FileInputStream(r("external-secondary-csv-bom.csv")));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"label","name","first"
"label","name","first", extra
"A","a",
B,b,
C,c
Expand All @@ -7,3 +7,4 @@ AB,ab,a
AC
"121 Main St, NE",main,m
"text; more text",foo,bar
a, b
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"label";"name";"first"
"label";"name";"first"; extra
"A";"a";
B;b;
C;c
Expand All @@ -7,3 +7,4 @@ AB;ab;a
AC
"121 Main St, NE";main;m
"text; more text";foo;bar
a; b