Skip to content

Commit 4daf2c9

Browse files
committed
.
1 parent 34d4397 commit 4daf2c9

2 files changed

Lines changed: 63 additions & 52 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package io.github.quafadas.scautable
2+
3+
import java.math.BigInteger
4+
5+
import scala.compiletime.testing.*
6+
7+
import io.github.quafadas.scautable.HeaderOptions.*
8+
import io.github.quafadas.table.TypeInferrer
9+
import munit.FunSuite
10+
11+
class CsvFromBigStringSuite extends FunSuite:
12+
13+
test("fromString should handle duplicated headers by parsing correctly but warn at compile time") {
14+
inline val csvContent =
15+
"colA,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col116,col17,col18,col19,col20,col21,col22,col23,col24,col25,colA,col2,col3,col4,col5,col6,col7,col8,col9,col10\n1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3"
16+
val csvIterator = CSV.fromString(
17+
csvContent,
18+
HeaderOptions.FromRows(1),
19+
TypeInferrer.FromTuple[
20+
(
21+
Int,
22+
String,
23+
Int,
24+
Int,
25+
Int,
26+
Int,
27+
Int,
28+
Int,
29+
Int,
30+
Int,
31+
Int,
32+
Int,
33+
Int,
34+
Int,
35+
Int,
36+
Int,
37+
Int,
38+
Int,
39+
Int,
40+
Int,
41+
Int,
42+
Int,
43+
Int,
44+
Int,
45+
Int,
46+
Int,
47+
Int,
48+
Int,
49+
Int,
50+
Int,
51+
Int,
52+
Int,
53+
Int,
54+
Int,
55+
Int
56+
)
57+
]()
58+
)
59+
assert(csvIterator.hasNext)
60+
val row = csvIterator.next()
61+
assertEquals(row.colA, 1)
62+
assert(!csvIterator.hasNext)
63+
}

scautable/test/src/io/github/quafadas/scautable/CsvFromStringSuite.scala

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -66,58 +66,6 @@ class CsvFromStringSuite extends FunSuite:
6666
assert(errors.exists(_.message.contains("Empty CSV content provided.")))
6767
}
6868

69-
test("fromString should handle duplicated headers by parsing correctly but warn at compile time") {
70-
inline val csvContent =
71-
"colA,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col116,col17,col18,col19,col20,col21,col22,col23,col24,col25,colA,col2,col3,col4,col5,col6,col7,col8,col9,col10\n1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,1,2"
72-
val csvIterator = CSV.fromString(
73-
csvContent,
74-
HeaderOptions.FromRows(1),
75-
TypeInferrer.FromTuple[
76-
(
77-
Int,
78-
String,
79-
Int,
80-
Int,
81-
Int,
82-
Int,
83-
Int,
84-
Int,
85-
Int,
86-
Int,
87-
Int,
88-
Int,
89-
Int,
90-
Int,
91-
Int,
92-
Int,
93-
Int,
94-
Int,
95-
Int,
96-
Int,
97-
Int,
98-
Int,
99-
Int,
100-
Int,
101-
Int,
102-
Int,
103-
Int,
104-
Int,
105-
Int,
106-
Int,
107-
Int,
108-
Int,
109-
Int,
110-
Int,
111-
Int
112-
)
113-
]()
114-
)
115-
assert(csvIterator.hasNext)
116-
val row = csvIterator.next()
117-
assertEquals(row.colA, 1)
118-
assert(!csvIterator.hasNext)
119-
}
120-
12169
test("fromString should handle duplicated headers by parsing correctly but warn at compile time") {
12270
inline val csvContent =
12371
"colA,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col116,col17,col18,col19,col20,col21,col22,col23,col24,col25,colA,col2,col3,col4,col5,col6,col7,col8,col9,col10\n1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,1,2"

0 commit comments

Comments
 (0)