1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-27 16:10:57 -05:00
denoland-deno/colors/test.ts
2019-03-06 16:39:50 -05:00

25 lines
781 B
TypeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { test } from "../testing/mod.ts";
import { assertEq } from "../testing/asserts.ts";
import { red, bgBlue, setEnabled, getEnabled } from "./mod.ts";
import "./example.ts";
test(function singleColor() {
assertEq(red("Hello world"), "Hello world");
});
test(function doubleColor() {
assertEq(bgBlue(red("Hello world")), "Hello world");
});
test(function replacesCloseCharacters() {
assertEq(red("Hello"), "Hello");
});
test(function enablingColors() {
assertEq(getEnabled(), true);
setEnabled(false);
assertEq(bgBlue(red("Hello world")), "Hello world");
setEnabled(true);
assertEq(red("Hello world"), "Hello world");
});