summaryrefslogtreecommitdiff
path: root/io/util_test.ts
diff options
context:
space:
mode:
authorYusuke Sakurai <kerokerokerop@gmail.com>2019-02-11 08:49:48 +0900
committerRyan Dahl <ry@tinyclouds.org>2019-02-10 18:49:48 -0500
commit33f62789cde407059abba0a7ac18b2145c648ea7 (patch)
tree454d487f232a61f6c57e2ebdad66e49bf939e4d6 /io/util_test.ts
parented20bda6ec324b8143c6210024647d2692232c26 (diff)
feat: multipart, etc.. (denoland/deno_std#180)
Original: https://github.com/denoland/deno_std/commit/fda9c98d055091fa886fa444ebd1adcd2ecd21bc
Diffstat (limited to 'io/util_test.ts')
-rw-r--r--io/util_test.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/io/util_test.ts b/io/util_test.ts
index 90ae5d4c1..c3f134616 100644
--- a/io/util_test.ts
+++ b/io/util_test.ts
@@ -1,6 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { test, assert } from "../testing/mod.ts";
-import { copyBytes } from "./util.ts";
+import { copyBytes, tempFile } from "./util.ts";
+import { remove } from "deno";
+import * as path from "../fs/path.ts";
test(function testCopyBytes() {
let dst = new Uint8Array(4);
@@ -35,3 +37,14 @@ test(function testCopyBytes() {
assert(len === 2);
assert.equal(dst, Uint8Array.of(3, 4, 0, 0));
});
+
+test(async function ioTempfile() {
+ const f = await tempFile(".", {
+ prefix: "prefix-",
+ postfix: "-postfix"
+ });
+ console.log(f.file, f.filepath);
+ const base = path.basename(f.filepath);
+ assert.assert(!!base.match(/^prefix-.+?-postfix$/));
+ await remove(f.filepath);
+});