mirror of
https://github.com/denoland/deno.git
synced 2024-12-30 11:16:38 -05:00
2e1ed890b8
Original: b699fa67be
25 lines
818 B
TypeScript
25 lines
818 B
TypeScript
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||
import { test } from "../testing/mod.ts";
|
||
import { assertEquals } from "../testing/asserts.ts";
|
||
import { red, bgBlue, setEnabled, getEnabled } from "./mod.ts";
|
||
import "../examples/colors.ts";
|
||
|
||
test(function singleColor() {
|
||
assertEquals(red("Hello world"), "[31mHello world[39m");
|
||
});
|
||
|
||
test(function doubleColor() {
|
||
assertEquals(bgBlue(red("Hello world")), "[44m[31mHello world[39m[49m");
|
||
});
|
||
|
||
test(function replacesCloseCharacters() {
|
||
assertEquals(red("Hel[39mlo"), "[31mHel[31mlo[39m");
|
||
});
|
||
|
||
test(function enablingColors() {
|
||
assertEquals(getEnabled(), true);
|
||
setEnabled(false);
|
||
assertEquals(bgBlue(red("Hello world")), "Hello world");
|
||
setEnabled(true);
|
||
assertEquals(red("Hello world"), "[31mHello world[39m");
|
||
});
|