summaryrefslogtreecommitdiff
path: root/std/io/util_test.ts
blob: c602a90d36a0911e75434ca1a14a9ac2c4fc9f55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { assert } from "../testing/asserts.ts";
import * as path from "../path/mod.ts";
import { tempFile } from "./util.ts";

Deno.test({
  name: "[io/util] tempfile",
  fn: async function (): Promise<void> {
    const f = await tempFile(".", {
      prefix: "prefix-",
      postfix: "-postfix",
    });
    const base = path.basename(f.filepath);
    assert(!!base.match(/^prefix-.+?-postfix$/));
    f.file.close();
    await Deno.remove(f.filepath);
  },
});