Skip to content

Commit 1db1e4d

Browse files
committed
added test about dir2array
1 parent aa8f819 commit 1db1e4d

9 files changed

Lines changed: 17 additions & 4 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
temp/

dir2array.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@ const dig = async (path, files) => {
99
}
1010
};
1111

12-
const dir2array = async (path) => {
12+
export const dir2array = async (path) => {
1313
if (path.endsWith("/")) {
1414
path.substring(0, path.length - 1);
1515
}
1616
const res = [];
1717
await dig(path, res);
18-
return res.map(fn => fn.substring(path.length + 1));
18+
return res.map(fn => fn.substring(path.length + 1));//.sort();
1919
};
2020

21-
export { dir2array };
22-
2321
/*
2422
if (import.meta.url.endsWith("/dir2array.js")) {
2523
const ext = Deno.args[0] || "";

test/dir2array-test/0.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a

test/dir2array-test/a.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a

test/dir2array-test/b/0.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a

test/dir2array-test/b/a.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a

test/dir2array-test/b/b.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a

test/dir2array-test/c.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a

test/dir2array.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import * as t from "https://deno.land/std/testing/asserts.ts";
2+
import { dir2array } from "../dir2array.js";
3+
4+
Deno.test("simple", async () => {
5+
const ss = await dir2array("dir2array-test");
6+
console.log(ss);
7+
//t.assertEquals(encodeHTML("&<>"), "&amp;&lt;&gt;");
8+
});

0 commit comments

Comments
 (0)