0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-08 07:16:56 -05:00

fix: compilation error introduced by #4543 (#5673)

This commit is contained in:
uki00a 2020-05-21 01:15:41 +09:00 committed by GitHub
parent 22da75b8e5
commit 6d7e3621da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -447,21 +447,24 @@ Deno.test("readStringDelimAndLines", async function (): Promise<void> {
assertEquals(lines_, ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]); assertEquals(lines_, ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]);
}); });
Deno.test(async function bufReaderShouldNotShareArrayBufferAcrossReads() { Deno.test(
const decoder = new TextDecoder(); "bufReaderShouldNotShareArrayBufferAcrossReads",
const data = "abcdefghijklmnopqrstuvwxyz"; async function (): Promise<void> {
const bufSize = 25; const decoder = new TextDecoder();
const b = new BufReader(stringsReader(data), bufSize); const data = "abcdefghijklmnopqrstuvwxyz";
const bufSize = 25;
const b = new BufReader(stringsReader(data), bufSize);
const r1 = (await b.readLine()) as ReadLineResult; const r1 = (await b.readLine()) as ReadLineResult;
assertNotEOF(r1); assert(r1 !== null);
assertEquals(decoder.decode(r1.line), "abcdefghijklmnopqrstuvwxy"); assertEquals(decoder.decode(r1.line), "abcdefghijklmnopqrstuvwxy");
const r2 = (await b.readLine()) as ReadLineResult; const r2 = (await b.readLine()) as ReadLineResult;
assertNotEOF(r2); assert(r2 !== null);
assertEquals(decoder.decode(r2.line), "z"); assertEquals(decoder.decode(r2.line), "z");
assert( assert(
r1.line.buffer !== r2.line.buffer, r1.line.buffer !== r2.line.buffer,
"array buffer should not be shared across reads" "array buffer should not be shared across reads"
); );
}); }
);