summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/sync_test.ts36
1 files changed, 36 insertions, 0 deletions
diff --git a/cli/tests/unit/sync_test.ts b/cli/tests/unit/sync_test.ts
index 7a489e951..fd6acd858 100644
--- a/cli/tests/unit/sync_test.ts
+++ b/cli/tests/unit/sync_test.ts
@@ -3,6 +3,42 @@ import { unitTest, assertEquals } from "./test_util.ts";
unitTest(
{ perms: { read: true, write: true } },
+ function fdatasyncSyncSuccess(): void {
+ const filename = Deno.makeTempDirSync() + "/test_fdatasyncSync.txt";
+ const file = Deno.openSync(filename, {
+ read: true,
+ write: true,
+ create: true,
+ });
+ const data = new Uint8Array(64);
+ Deno.writeSync(file.rid, data);
+ Deno.fdatasyncSync(file.rid);
+ assertEquals(Deno.readFileSync(filename), data);
+ Deno.close(file.rid);
+ Deno.removeSync(filename);
+ }
+);
+
+unitTest(
+ { perms: { read: true, write: true } },
+ async function fdatasyncSuccess(): Promise<void> {
+ const filename = (await Deno.makeTempDir()) + "/test_fdatasync.txt";
+ const file = await Deno.open(filename, {
+ read: true,
+ write: true,
+ create: true,
+ });
+ const data = new Uint8Array(64);
+ await Deno.write(file.rid, data);
+ await Deno.fdatasync(file.rid);
+ assertEquals(await Deno.readFile(filename), data);
+ Deno.close(file.rid);
+ await Deno.remove(filename);
+ }
+);
+
+unitTest(
+ { perms: { read: true, write: true } },
function fsyncSyncSuccess(): void {
const filename = Deno.makeTempDirSync() + "/test_fsyncSync.txt";
const file = Deno.openSync(filename, {