1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-22 06:09:25 -05:00

test(std/io): use a real tempdir (#8019)

This replaces a case of a temp file in the working tree with a tempfile
in a real temporary directory avoiding pollution of the working
directory.
This commit is contained in:
Casper Beyer 2020-10-19 00:16:26 +08:00 committed by GitHub
parent 3e51610bbb
commit 065db9df19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,8 +9,6 @@ import {
} from "./ioutil.ts";
import { StringReader } from "./readers.ts";
import { BufReader } from "./bufio.ts";
import { tempFile } from "./util.ts";
import * as path from "../path/mod.ts";
class BinaryReader implements Deno.Reader {
index = 0;
@ -87,7 +85,10 @@ Deno.test("testCopyN2", async function (): Promise<void> {
});
Deno.test("copyNWriteAllData", async function (): Promise<void> {
const { filepath, file } = await tempFile(path.resolve("io"));
const tmpDir = await Deno.makeTempDir();
const filepath = `${tmpDir}/data`;
const file = await Deno.open(filepath, { create: true, write: true });
const size = 16 * 1024 + 1;
const data = "a".repeat(32 * 1024);
const r = new StringReader(data);