summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tests/unit/command_test.ts3
-rw-r--r--cli/tests/unit/process_test.ts3
-rw-r--r--cli/tests/unit_node/_fs/_fs_ftruncate_test.ts4
-rw-r--r--cli/tests/unit_node/_fs/_fs_truncate_test.ts4
-rw-r--r--cli/tsc/dts/lib.deno.ns.d.ts2
5 files changed, 7 insertions, 9 deletions
diff --git a/cli/tests/unit/command_test.ts b/cli/tests/unit/command_test.ts
index 1c707651c..cbb1c4921 100644
--- a/cli/tests/unit/command_test.ts
+++ b/cli/tests/unit/command_test.ts
@@ -208,8 +208,7 @@ Deno.test(
async function commandRedirectStdin() {
const tempDir = await Deno.makeTempDir();
const fileName = tempDir + "/redirected_stdio.txt";
- const encoder = new TextEncoder();
- await Deno.writeFile(fileName, encoder.encode("hello"));
+ await Deno.writeTextFile(fileName, "hello");
const file = await Deno.open(fileName);
const command = new Deno.Command(Deno.execPath(), {
diff --git a/cli/tests/unit/process_test.ts b/cli/tests/unit/process_test.ts
index f6ad2a5cd..cb5dd0815 100644
--- a/cli/tests/unit/process_test.ts
+++ b/cli/tests/unit/process_test.ts
@@ -395,8 +395,7 @@ Deno.test(
async function runRedirectStdin() {
const tempDir = await Deno.makeTempDir();
const fileName = tempDir + "/redirected_stdio.txt";
- const encoder = new TextEncoder();
- await Deno.writeFile(fileName, encoder.encode("hello"));
+ await Deno.writeTextFile(fileName, "hello");
const file = await Deno.open(fileName);
// deno-lint-ignore no-deprecated-deno-api
diff --git a/cli/tests/unit_node/_fs/_fs_ftruncate_test.ts b/cli/tests/unit_node/_fs/_fs_ftruncate_test.ts
index a843b19b7..4c2c34789 100644
--- a/cli/tests/unit_node/_fs/_fs_ftruncate_test.ts
+++ b/cli/tests/unit_node/_fs/_fs_ftruncate_test.ts
@@ -24,7 +24,7 @@ Deno.test({
name: "ASYNC: truncate entire file contents",
async fn() {
const file: string = Deno.makeTempFileSync();
- await Deno.writeFile(file, new TextEncoder().encode("hello world"));
+ await Deno.writeTextFile(file, "hello world");
const { rid } = await Deno.open(file, {
read: true,
write: true,
@@ -57,7 +57,7 @@ Deno.test({
name: "ASYNC: truncate file to a size of precisely len bytes",
async fn() {
const file: string = Deno.makeTempFileSync();
- await Deno.writeFile(file, new TextEncoder().encode("hello world"));
+ await Deno.writeTextFile(file, "hello world");
const { rid } = await Deno.open(file, {
read: true,
write: true,
diff --git a/cli/tests/unit_node/_fs/_fs_truncate_test.ts b/cli/tests/unit_node/_fs/_fs_truncate_test.ts
index 00e03ab0e..ff087095b 100644
--- a/cli/tests/unit_node/_fs/_fs_truncate_test.ts
+++ b/cli/tests/unit_node/_fs/_fs_truncate_test.ts
@@ -24,7 +24,7 @@ Deno.test({
name: "ASYNC: truncate entire file contents",
async fn() {
const file: string = Deno.makeTempFileSync();
- await Deno.writeFile(file, new TextEncoder().encode("hello world"));
+ await Deno.writeTextFile(file, "hello world");
await new Promise<void>((resolve, reject) => {
truncate(file, (err: Error | null) => {
@@ -49,7 +49,7 @@ Deno.test({
name: "ASYNC: truncate file to a size of precisely len bytes",
async fn() {
const file: string = Deno.makeTempFileSync();
- await Deno.writeFile(file, new TextEncoder().encode("hello world"));
+ await Deno.writeTextFile(file, "hello world");
await new Promise<void>((resolve, reject) => {
truncate(file, 3, (err: Error | null) => {
diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts
index 4107e1369..f17f9088d 100644
--- a/cli/tsc/dts/lib.deno.ns.d.ts
+++ b/cli/tsc/dts/lib.deno.ns.d.ts
@@ -3717,7 +3717,7 @@ declare namespace Deno {
*
* ```ts
* const file = await Deno.makeTempFile();
- * await Deno.writeFile(file, new TextEncoder().encode("Hello World"));
+ * await Deno.writeTextFile(file, "Hello World");
* await Deno.truncate(file, 7);
* const data = await Deno.readFile(file);
* console.log(new TextDecoder().decode(data)); // "Hello W"