Skip to content

Commit 4a9ae5b

Browse files
committed
Spaces after CSV delimiters are not stripped
1 parent a5ea1e9 commit 4a9ae5b

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/test/java/org/javarosa/core/model/instance/CsvExternalInstanceTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ public void heading_has_no_extra_quotes() {
2828
assertEquals("label", semiColonSeparated.getChildAt(0).getChildAt(0).getName());
2929
}
3030

31+
@Test
32+
public void heading_spaces_are_not_stripped() {
33+
assertEquals(" extra", commaSeparated.getChildAt(0).getChildAt(3).getName());
34+
assertEquals(" extra", semiColonSeparated.getChildAt(0).getChildAt(3).getName());
35+
}
36+
3137
@Test
3238
public void value_has_no_extra_quotes() {
3339
assertEquals("A", commaSeparated.getChildAt(0).getChildAt(0).getValue().getValue());
@@ -54,6 +60,12 @@ public void missing_fields_replaced_with_spaces() {
5460
}
5561
}
5662

63+
@Test
64+
public void value_spaces_are_not_stripped() {
65+
assertEquals(" b", commaSeparated.getChildAt(8).getChildAt(1).getValue().getValue());
66+
assertEquals(" b", semiColonSeparated.getChildAt(8).getChildAt(1).getValue().getValue());
67+
}
68+
5769
@Test
5870
public void ignores_utf8_bom() throws IOException {
5971
BOMInputStream bomIs = new BOMInputStream(new FileInputStream(r("external-secondary-csv-bom.csv")));
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"label","name","first"
1+
"label","name","first", extra
22
"A","a",
33
B,b,
44
C,c
@@ -7,3 +7,4 @@ AB,ab,a
77
AC
88
"121 Main St, NE",main,m
99
"text; more text",foo,bar
10+
a, b
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"label";"name";"first"
1+
"label";"name";"first"; extra
22
"A";"a";
33
B;b;
44
C;c
@@ -7,3 +7,4 @@ AB;ab;a
77
AC
88
"121 Main St, NE";main;m
99
"text; more text";foo;bar
10+
a; b

0 commit comments

Comments
 (0)