2019-01-19 21:09:35 +11:00
|
|
|
|
import { assert, test } from "../testing/mod.ts";
|
|
|
|
|
import { red, bgBlue, setEnabled, getEnabled } from "./mod.ts";
|
2019-01-11 12:18:21 +11:00
|
|
|
|
import "./example.ts";
|
2018-12-19 15:30:44 +11:00
|
|
|
|
|
|
|
|
|
test(function singleColor() {
|
2019-01-19 21:09:35 +11:00
|
|
|
|
assert.equal(red("Hello world"), "[31mHello world[39m");
|
2018-12-19 15:30:44 +11:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test(function doubleColor() {
|
2019-01-19 21:09:35 +11:00
|
|
|
|
assert.equal(bgBlue(red("Hello world")), "[44m[31mHello world[39m[49m");
|
2019-01-15 21:16:52 +00:00
|
|
|
|
});
|
|
|
|
|
|
2019-01-19 21:09:35 +11:00
|
|
|
|
test(function replacesCloseCharacters() {
|
|
|
|
|
assert.equal(red("Hel[39mlo"), "[31mHel[31mlo[39m");
|
2019-01-15 21:16:52 +00:00
|
|
|
|
});
|
|
|
|
|
|
2019-01-19 21:09:35 +11:00
|
|
|
|
test(function enablingColors() {
|
|
|
|
|
assert.equal(getEnabled(), true);
|
|
|
|
|
setEnabled(false);
|
|
|
|
|
assert.equal(bgBlue(red("Hello world")), "Hello world");
|
2018-12-19 15:30:44 +11:00
|
|
|
|
});
|