deno.land / std@0.224.0 / io / copy_test.ts
1234567891011121314151617181920212223// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.import { copy } from "./copy.ts";import { assertEquals } from "../assert/assert_equals.ts";
const SRC_PATH = "./io/testdata/copy-src.txt";const DST_PATH = "./io/testdata/copy-dst.txt";
Deno.test("copy()", async () => { try { using srcFile = await Deno.open(SRC_PATH); using dstFile = await Deno.open(DST_PATH, { create: true, write: true, }); await copy(srcFile, dstFile); const srcOutput = await Deno.readFile(SRC_PATH); const dstOutput = await Deno.readFile(DST_PATH); assertEquals(srcOutput, dstOutput); } finally { await Deno.remove(DST_PATH); }});
Version Info