mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 21:24:48 +00:00
io: refactor BufReader/Writer interfaces to be more idiomatic (denoland/deno_std#444)
Thanks Vincent Le Goff (@zekth) for porting over the CSV reader
implementation.
Fixes: denoland/deno_std#436
Original: 0ee6334b69
This commit is contained in:
parent
5b37b560fb
commit
b95f79d74c
14 changed files with 779 additions and 652 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue