-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unwrap_test.ts
23 lines (22 loc) · 856 Bytes
/
unwrap_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
import * as path from "https://deno.land/[email protected]/path/mod.ts";
import { filter } from "./unwrap.ts";
Deno.test(async function filterTest(t) {
const dataDirectory = "testdata";
const suffix = ".in.md";
const contents = Deno.readDir(dataDirectory);
for await (const ent of contents) {
if (!ent.isFile || ent.name.startsWith(".") || !ent.name.endsWith(suffix)) {
continue;
}
const base = ent.name.substring(0, ent.name.length - suffix.length);
await t.step(base, async () => {
const input = await Deno.readTextFile(path.join(dataDirectory, ent.name));
const want = await Deno.readTextFile(
path.join(dataDirectory, base + ".out.md"),
);
const got = filter(input);
assertEquals(got, want);
});
}
});