// 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("testBrightBlack", function (): void { assertEquals(c.brightBlack("foo bar"), "foo bar"); }); Deno.test("testBrightRed", function (): void { assertEquals(c.brightRed("foo bar"), "foo bar"); }); Deno.test("testBrightGreen", function (): void { assertEquals(c.brightGreen("foo bar"), "foo bar"); }); Deno.test("testBrightYellow", function (): void { assertEquals(c.brightYellow("foo bar"), "foo bar"); }); Deno.test("testBrightBlue", function (): void { assertEquals(c.brightBlue("foo bar"), "foo bar"); }); Deno.test("testBrightMagenta", function (): void { assertEquals(c.brightMagenta("foo bar"), "foo bar"); }); Deno.test("testBrightCyan", function (): void { assertEquals(c.brightCyan("foo bar"), "foo bar"); }); Deno.test("testBrightWhite", function (): void { assertEquals(c.brightWhite("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"); }); Deno.test("testBgBrightBlack", function (): void { assertEquals(c.bgBrightBlack("foo bar"), "foo bar"); }); Deno.test("testBgBrightRed", function (): void { assertEquals(c.bgBrightRed("foo bar"), "foo bar"); }); Deno.test("testBgBrightGreen", function (): void { assertEquals(c.bgBrightGreen("foo bar"), "foo bar"); }); Deno.test("testBgBrightYellow", function (): void { assertEquals(c.bgBrightYellow("foo bar"), "foo bar"); }); Deno.test("testBgBrightBlue", function (): void { assertEquals(c.bgBrightBlue("foo bar"), "foo bar"); }); Deno.test("testBgBrightMagenta", function (): void { assertEquals(c.bgBrightMagenta("foo bar"), "foo bar"); }); Deno.test("testBgBrightCyan", function (): void { assertEquals(c.bgBrightCyan("foo bar"), "foo bar"); }); Deno.test("testBgBrightWhite", function (): void { assertEquals(c.bgBrightWhite("foo bar"), "foo bar"); }); Deno.test("testClampUsingRgb8", function (): void { assertEquals(c.rgb8("foo bar", -10), "foo bar"); }); Deno.test("testTruncateUsingRgb8", function (): void { assertEquals(c.rgb8("foo bar", 42.5), "foo bar"); }); Deno.test("testRgb8", function (): void { assertEquals(c.rgb8("foo bar", 42), "foo bar"); }); Deno.test("test_bgRgb8", function (): void { assertEquals(c.bgRgb8("foo bar", 42), "foo bar"); }); Deno.test("test_rgb24", function (): void { assertEquals( c.rgb24("foo bar", { r: 41, g: 42, b: 43, }), "foo bar", ); }); Deno.test("test_rgb24number", function (): void { assertEquals(c.rgb24("foo bar", 0x070809), "foo bar"); }); Deno.test("test_bgRgb24", function (): void { assertEquals( c.bgRgb24("foo bar", { r: 41, g: 42, b: 43, }), "foo bar", ); }); Deno.test("test_bgRgb24number", function (): void { assertEquals(c.bgRgb24("foo bar", 0x070809), "foo bar"); });