1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
denoland-deno/std/fmt/colors_test.ts

121 lines
3.3 KiB
TypeScript
Raw Normal View History

2020-01-02 15:13:47 -05:00
// 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("singleColor", function (): void {
assertEquals(c.red("foo bar"), "foo bar");
});
Deno.test("doubleColor", function (): void {
assertEquals(c.bgBlue(c.red("foo bar")), "foo bar");
});
Deno.test("replacesCloseCharacters", function (): void {
assertEquals(c.red("Hello"), "Hello");
});
Deno.test("enablingColors", function (): 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("testBold", function (): void {
assertEquals(c.bold("foo bar"), "foo bar");
});
Deno.test("testDim", function (): void {
assertEquals(c.dim("foo bar"), "foo bar");
});
Deno.test("testItalic", function (): void {
assertEquals(c.italic("foo bar"), "foo bar");
});
Deno.test("testUnderline", function (): void {
assertEquals(c.underline("foo bar"), "foo bar");
});
Deno.test("testInverse", function (): void {
assertEquals(c.inverse("foo bar"), "foo bar");
});
Deno.test("testHidden", function (): void {
assertEquals(c.hidden("foo bar"), "foo bar");
});
Deno.test("testStrikethrough", function (): void {
assertEquals(c.strikethrough("foo bar"), "foo bar");
});
Deno.test("testBlack", function (): void {
assertEquals(c.black("foo bar"), "foo bar");
});
Deno.test("testRed", function (): void {
assertEquals(c.red("foo bar"), "foo bar");
});
Deno.test("testGreen", function (): void {
assertEquals(c.green("foo bar"), "foo bar");
});
Deno.test("testYellow", function (): void {
assertEquals(c.yellow("foo bar"), "foo bar");
});
Deno.test("testBlue", function (): void {
assertEquals(c.blue("foo bar"), "foo bar");
});
Deno.test("testMagenta", function (): void {
assertEquals(c.magenta("foo bar"), "foo bar");
});
Deno.test("testCyan", function (): void {
assertEquals(c.cyan("foo bar"), "foo bar");
});
Deno.test("testWhite", function (): void {
assertEquals(c.white("foo bar"), "foo bar");
});
Deno.test("testGray", function (): void {
assertEquals(c.gray("foo bar"), "foo bar");
});
Deno.test("testBgBlack", function (): void {
assertEquals(c.bgBlack("foo bar"), "foo bar");
});
Deno.test("testBgRed", function (): void {
assertEquals(c.bgRed("foo bar"), "foo bar");
});
Deno.test("testBgGreen", function (): void {
assertEquals(c.bgGreen("foo bar"), "foo bar");
});
Deno.test("testBgYellow", function (): void {
assertEquals(c.bgYellow("foo bar"), "foo bar");
});
Deno.test("testBgBlue", function (): void {
assertEquals(c.bgBlue("foo bar"), "foo bar");
});
Deno.test("testBgMagenta", function (): void {
assertEquals(c.bgMagenta("foo bar"), "foo bar");
});
Deno.test("testBgCyan", function (): void {
assertEquals(c.bgCyan("foo bar"), "foo bar");
});
Deno.test("testBgWhite", function (): void {
assertEquals(c.bgWhite("foo bar"), "foo bar");
});