From 4f9bb11444ba7236f28ef1e722100b485c185c7c Mon Sep 17 00:00:00 2001 From: Akshat Agarwal Date: Mon, 27 Apr 2020 01:56:02 +0530 Subject: reorder copyN arguments to match Deno.copy (#4900) --- std/io/ioutil.ts | 2 +- std/io/ioutil_test.ts | 4 ++-- std/io/readers_test.ts | 2 +- std/io/writers_test.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'std/io') diff --git a/std/io/ioutil.ts b/std/io/ioutil.ts index cfcfdf794..9a727f436 100644 --- a/std/io/ioutil.ts +++ b/std/io/ioutil.ts @@ -8,8 +8,8 @@ import { assert } from "../testing/asserts.ts"; * If read size is lesser than N, then returns nread * */ export async function copyN( - dest: Writer, r: Reader, + dest: Writer, size: number ): Promise { let bytesRead = 0; diff --git a/std/io/ioutil_test.ts b/std/io/ioutil_test.ts index d00986da5..bb01811ad 100644 --- a/std/io/ioutil_test.ts +++ b/std/io/ioutil_test.ts @@ -73,7 +73,7 @@ Deno.test(function testSliceLongToBytes2(): void { Deno.test(async function testCopyN1(): Promise { const w = new Buffer(); const r = stringsReader("abcdefghij"); - const n = await copyN(w, r, 3); + const n = await copyN(r, w, 3); assertEquals(n, 3); assertEquals(w.toString(), "abc"); }); @@ -81,7 +81,7 @@ Deno.test(async function testCopyN1(): Promise { Deno.test(async function testCopyN2(): Promise { const w = new Buffer(); const r = stringsReader("abcdefghij"); - const n = await copyN(w, r, 11); + const n = await copyN(r, w, 11); assertEquals(n, 10); assertEquals(w.toString(), "abcdefghij"); }); diff --git a/std/io/readers_test.ts b/std/io/readers_test.ts index 041fd78a8..05b63b892 100644 --- a/std/io/readers_test.ts +++ b/std/io/readers_test.ts @@ -30,7 +30,7 @@ test(async function ioStringReader(): Promise { test(async function ioMultiReader(): Promise { const r = new MultiReader(new StringReader("abc"), new StringReader("def")); const w = new StringWriter(); - const n = await copyN(w, r, 4); + const n = await copyN(r, w, 4); assertEquals(n, 4); assertEquals(w.toString(), "abcd"); await copy(r, w); diff --git a/std/io/writers_test.ts b/std/io/writers_test.ts index 96dc044ae..24f2f3b3f 100644 --- a/std/io/writers_test.ts +++ b/std/io/writers_test.ts @@ -7,7 +7,7 @@ import { copyN } from "./ioutil.ts"; test(async function ioStringWriter(): Promise { const w = new StringWriter("base"); const r = new StringReader("0123456789"); - await copyN(w, r, 4); + await copyN(r, w, 4); assertEquals(w.toString(), "base0123"); await copy(r, w); assertEquals(w.toString(), "base0123456789"); -- cgit v1.2.3