Skip to content

Commit

Permalink
Add input redirect with readable test
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Jan 28, 2024
1 parent 1c40b4c commit 85ce3f7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mod.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
assertRejects,
assertStringIncludes,
assertThrows,
toReadableStream,
toWritableStream,
withTempDir,
} from "./src/deps.test.ts";
Expand Down Expand Up @@ -1159,6 +1160,21 @@ Deno.test("input redirects", async () => {
});
});

Deno.test("input redirects with readable", async () => {
{
const text = "testing".repeat(1000);
const bytes = new TextEncoder().encode(text);
const stream = new ReadableStream({
start(controller) {
controller.enqueue(bytes);
controller.close();
},
});
const output = await $`cat - < ${stream}`.text();
assertEquals(output, text);
}
});

Deno.test("output redirect with writable", async () => {
await withTempDir(async (tempDir) => {
const buffer = new Buffer();
Expand Down

0 comments on commit 85ce3f7

Please sign in to comment.