summaryrefslogtreecommitdiff
path: root/colors/test.ts
blob: 266868090ff7e6b3df24869f4c15c8a8b400eddf (plain)
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
import { assertEqual, test } from "../testing/mod.ts";
import { color } from "./mod.ts";
import "./example.ts";

test(function singleColor() {
  assertEqual(color.red("Hello world"), "Hello world");
});

test(function doubleColor() {
  assertEqual(color.red.bgBlue("Hello world"),
    "Hello world");
});

test(function newLinesContinueColors() {
  assertEqual(color.red("Hello\nworld"),
    "Hello\nworld");
  assertEqual(color.red("Hello\r\nworld"),
    "Hello\r\nworld");
  assertEqual(color.red("Hello\n\nworld"),
    "Hello\n\nworld");
});

test(function replacesCloseCharacters() {
  assertEqual(color.red("Hello"), "Hello");
});