Skip to content

Commit 6c93c83

Browse files
authored
test: use documentation tests (#9)
1 parent 6320940 commit 6c93c83

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

deno.json

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"./cli": "./src/cli.ts"
77
},
88
"tasks": {
9+
"test": "deno test --doc -A",
910
"cli": "deno run --allow-read --allow-write --allow-env --allow-net=0.0.0.0,127.0.0.1 --allow-run ./src/cli.ts --",
1011
"dev": "deno run --allow-read --allow-write --allow-env --allow-net=0.0.0.0,127.0.0.1 --allow-run ./src/cli.ts -- README.md",
1112
"dev:all": "deno run --allow-read --allow-write --allow-env --allow-net=0.0.0.0,127.0.0.1 --allow-run ./src/cli.ts -w --stylesheet=src/testdata/bluecode.css -- README.md",

src/utils/filename.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
/**
22
* Get a filename without extname from path.
33
*
4-
* @param path
4+
* @example
5+
* ```ts
6+
* import { assertEquals } from "@std/assert";
7+
*
8+
* assertEquals(getFilename("README.md"), "README");
9+
* assertEquals(getFilename("/README.md"), "/README");
10+
* assertEquals(getFilename("./README.md"), "./README");
11+
* assertEquals(getFilename("../README.md"), "../README");
12+
* assertEquals(getFilename("README.2.md"), "README.2");
13+
* ```
514
*/
615
export function getFilename(path: string): string {
716
return path.split(".").slice(0, -1).join(".");

src/utils/filename_test.ts

-10
This file was deleted.

0 commit comments

Comments
 (0)