-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod.test.ts
37 lines (29 loc) · 890 Bytes
/
mod.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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import TermBox from "./mod.ts";
import { assertThrows } from "https://deno.land/[email protected]/testing/asserts.ts";
Deno.test(`test Hello world`, async () => {
const termbox = new TermBox();
await termbox.cursorHide();
await termbox.screenClear();
let i = 0;
for (const char of "Hello world!") {
termbox.setCell(i++, 0, char);
}
await termbox.flush();
termbox.cursorTo(0, 0);
await termbox.cursorShow();
termbox.end();
});
Deno.test(`test throw error`, () => {
const termbox = new TermBox();
assertThrows((): void => {
termbox.setCell(0, 0, "Hello world!");
});
termbox.end();
});
Deno.test(`test position`, async () => {
const termbox = new TermBox();
console.log("stdout isatty: ", Deno.isatty(Deno.stdout.rid));
console.log("stdin isatty: ", Deno.isatty(Deno.stdin.rid));
console.log(await termbox.cursorPosition());
termbox.end();
});