Skip to content

Commit

Permalink
test(io): use a real tempdir (denoland/deno#8019)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
caspervonb authored and denobot committed Feb 1, 2021
1 parent f560c5f commit 0631d15
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions io/ioutil_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0631d15

Please sign in to comment.