Skip to content

Commit

Permalink
for format
Browse files Browse the repository at this point in the history
  • Loading branch information
loujiayu committed Jan 27, 2019
1 parent 03e4a39 commit e6b6ce7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions js/files_test.ts
Expand Up @@ -61,7 +61,7 @@ testPerm({ write: true }, async function createFile() {
f.close();

// TODO: test different modes
await deno.remove(tempDir, {recursive: true});
await deno.remove(tempDir, { recursive: true });
});

testPerm({ write: true }, async function openModeWrite() {
Expand Down Expand Up @@ -95,7 +95,7 @@ testPerm({ write: true }, async function openModeWrite() {
file.close();
const fileSize = deno.statSync(filename).len;
assertEqual(fileSize, 0);
await deno.remove(tempDir, {recursive: true});
await deno.remove(tempDir, { recursive: true });
});

testPerm({ write: true }, async function openModeWriteRead() {
Expand Down Expand Up @@ -124,5 +124,5 @@ testPerm({ write: true }, async function openModeWriteRead() {
// assertEqual(result.nread, 13);
// file.close();

await deno.remove(tempDir, {recursive: true});
await deno.remove(tempDir, { recursive: true });
});
3 changes: 2 additions & 1 deletion js/remove.ts
Expand Up @@ -29,7 +29,8 @@ export function removeSync(path: string, options: RemoveOption = {}): void {
*/
export async function remove(
path: string,
options: RemoveOption = {}): Promise<void> {
options: RemoveOption = {}
): Promise<void> {
await dispatch.sendAsync(...req(path, options));
}

Expand Down
20 changes: 10 additions & 10 deletions js/remove_test.ts
Expand Up @@ -92,7 +92,7 @@ testPerm({ write: true }, function removeAllSyncDirSuccess() {
deno.mkdirSync(path);
let pathInfo = deno.statSync(path);
assert(pathInfo.isDirectory()); // check exist first
deno.removeSync(path, {recursive: true}); // remove
deno.removeSync(path, { recursive: true }); // remove
// We then check again after remove
let err;
try {
Expand All @@ -112,7 +112,7 @@ testPerm({ write: true }, function removeAllSyncDirSuccess() {
assert(pathInfo.isDirectory()); // check exist first
const subPathInfo = deno.statSync(subPath);
assert(subPathInfo.isDirectory()); // check exist first
deno.removeSync(path, {recursive: true}); // remove
deno.removeSync(path, { recursive: true }); // remove
// We then check parent directory again after remove
try {
deno.statSync(path);
Expand All @@ -132,7 +132,7 @@ testPerm({ write: true }, function removeAllSyncFileSuccess() {
deno.writeFileSync(filename, data, 0o666);
const fileInfo = deno.statSync(filename);
assert(fileInfo.isFile()); // check exist first
deno.removeSync(filename, {recursive: true}); // remove
deno.removeSync(filename, { recursive: true }); // remove
// We then check again after remove
let err;
try {
Expand All @@ -150,7 +150,7 @@ testPerm({ write: true }, function removeAllSyncFail() {
let err;
try {
// Non-existent
deno.removeSync("/baddir", {recursive: true});
deno.removeSync("/baddir", { recursive: true });
} catch (e) {
err = e;
}
Expand All @@ -161,7 +161,7 @@ testPerm({ write: true }, function removeAllSyncFail() {
testPerm({ write: false }, function removeAllSyncPerm() {
let err;
try {
deno.removeSync("/baddir", {recursive: true});
deno.removeSync("/baddir", { recursive: true });
} catch (e) {
err = e;
}
Expand Down Expand Up @@ -258,7 +258,7 @@ testPerm({ write: true }, async function removeAllDirSuccess() {
deno.mkdirSync(path);
let pathInfo = deno.statSync(path);
assert(pathInfo.isDirectory()); // check exist first
await deno.remove(path, {recursive: true}); // remove
await deno.remove(path, { recursive: true }); // remove
// We then check again after remove
let err;
try {
Expand All @@ -278,7 +278,7 @@ testPerm({ write: true }, async function removeAllDirSuccess() {
assert(pathInfo.isDirectory()); // check exist first
const subPathInfo = deno.statSync(subPath);
assert(subPathInfo.isDirectory()); // check exist first
await deno.remove(path, {recursive: true}); // remove
await deno.remove(path, { recursive: true }); // remove
// We then check parent directory again after remove
try {
deno.statSync(path);
Expand All @@ -298,7 +298,7 @@ testPerm({ write: true }, async function removeAllFileSuccess() {
deno.writeFileSync(filename, data, 0o666);
const fileInfo = deno.statSync(filename);
assert(fileInfo.isFile()); // check exist first
await deno.remove(filename, {recursive: true}); // remove
await deno.remove(filename, { recursive: true }); // remove
// We then check again after remove
let err;
try {
Expand All @@ -316,7 +316,7 @@ testPerm({ write: true }, async function removeAllFail() {
let err;
try {
// Non-existent
await deno.remove("/baddir", {recursive: true});
await deno.remove("/baddir", { recursive: true });
} catch (e) {
err = e;
}
Expand All @@ -327,7 +327,7 @@ testPerm({ write: true }, async function removeAllFail() {
testPerm({ write: false }, async function removeAllPerm() {
let err;
try {
await deno.remove("/baddir", {recursive: true});
await deno.remove("/baddir", { recursive: true });
} catch (e) {
err = e;
}
Expand Down

0 comments on commit e6b6ce7

Please sign in to comment.