1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-23 15:16:54 -05:00
denoland-deno/std/fmt/colors_test.ts

120 lines
3.2 KiB
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-2020 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../testing/asserts.ts";
import * as c from "./colors.ts";
import "../examples/colors.ts";
Deno.test(function singleColor(): void {
assertEquals(c.red("foo bar"), "foo bar");
});
Deno.test(function doubleColor(): void {
assertEquals(c.bgBlue(c.red("foo bar")), "foo bar");
});
Deno.test(function replacesCloseCharacters(): void {
assertEquals(c.red("Hello"), "Hello");
});
Deno.test(function enablingColors(): void {
assertEquals(c.getColorEnabled(), true);
c.setColorEnabled(false);
assertEquals(c.bgBlue(c.red("foo bar")), "foo bar");
c.setColorEnabled(true);
assertEquals(c.red("foo bar"), "foo bar");
});
Deno.test(function testBold(): void {
assertEquals(c.bold("foo bar"), "foo bar");
});
Deno.test(function testDim(): void {
assertEquals(c.dim("foo bar"), "foo bar");
});
Deno.test(function testItalic(): void {
assertEquals(c.italic("foo bar"), "foo bar");
});
Deno.test(function testUnderline(): void {
assertEquals(c.underline("foo bar"), "foo bar");
});
Deno.test(function testInverse(): void {
assertEquals(c.inverse("foo bar"), "foo bar");
});
Deno.test(function testHidden(): void {
assertEquals(c.hidden("foo bar"), "foo bar");
});
Deno.test(function testStrikethrough(): void {
assertEquals(c.strikethrough("foo bar"), "foo bar");
});
Deno.test(function testBlack(): void {
assertEquals(c.black("foo bar"), "foo bar");
});
Deno.test(function testRed(): void {
assertEquals(c.red("foo bar"), "foo bar");
});
Deno.test(function testGreen(): void {
assertEquals(c.green("foo bar"), "foo bar");
});
Deno.test(function testYellow(): void {
assertEquals(c.yellow("foo bar"), "foo bar");
});
Deno.test(function testBlue(): void {
assertEquals(c.blue("foo bar"), "foo bar");
});
Deno.test(function testMagenta(): void {
assertEquals(c.magenta("foo bar"), "foo bar");
});
Deno.test(function testCyan(): void {
assertEquals(c.cyan("foo bar"), "foo bar");
});
Deno.test(function testWhite(): void {
assertEquals(c.white("foo bar"), "foo bar");
});
Deno.test(function testGray(): void {
assertEquals(c.gray("foo bar"), "foo bar");
});
Deno.test(function testBgBlack(): void {
assertEquals(c.bgBlack("foo bar"), "foo bar");
});
Deno.test(function testBgRed(): void {
assertEquals(c.bgRed("foo bar"), "foo bar");
});
Deno.test(function testBgGreen(): void {
assertEquals(c.bgGreen("foo bar"), "foo bar");
});
Deno.test(function testBgYellow(): void {
assertEquals(c.bgYellow("foo bar"), "foo bar");
});
Deno.test(function testBgBlue(): void {
assertEquals(c.bgBlue("foo bar"), "foo bar");
});
Deno.test(function testBgMagenta(): void {
assertEquals(c.bgMagenta("foo bar"), "foo bar");
});
Deno.test(function testBgCyan(): void {
assertEquals(c.bgCyan("foo bar"), "foo bar");
});
Deno.test(function testBgWhite(): void {
assertEquals(c.bgWhite("foo bar"), "foo bar");
});