diff options
Diffstat (limited to 'encoding/csv_test.ts')
| -rw-r--r-- | encoding/csv_test.ts | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/encoding/csv_test.ts b/encoding/csv_test.ts index 1ca68ea16..40a2abcef 100644 --- a/encoding/csv_test.ts +++ b/encoding/csv_test.ts @@ -437,20 +437,31 @@ for (const t of testCases) { if (t.LazyQuotes) { lazyquote = t.LazyQuotes; } - const actual = await readAll(new BufReader(new StringReader(t.Input)), { - comma: comma, - comment: comment, - trimLeadingSpace: trim, - fieldsPerRecord: fieldsPerRec, - lazyQuotes: lazyquote - }); + let actual; if (t.Error) { - assert(!!actual[1]); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const e: any = actual[1]; - assertEquals(e.message, t.Error); + let err; + try { + actual = await readAll(new BufReader(new StringReader(t.Input)), { + comma: comma, + comment: comment, + trimLeadingSpace: trim, + fieldsPerRecord: fieldsPerRec, + lazyQuotes: lazyquote + }); + } catch (e) { + err = e; + } + assert(err); + assertEquals(err.message, t.Error); } else { - const expected = [t.Output, null]; + actual = await readAll(new BufReader(new StringReader(t.Input)), { + comma: comma, + comment: comment, + trimLeadingSpace: trim, + fieldsPerRecord: fieldsPerRec, + lazyQuotes: lazyquote + }); + const expected = t.Output; assertEquals(actual, expected); } } |
