aboutsummaryrefslogtreecommitdiff
path: root/deps/node/deps/npm/node_modules/ansicolors/test/ansicolors.js
blob: 494539305d3acf875c15e9420a4d872d16dfda43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
'use strict';

var assert = require('assert')
  , colors = require('..')
  , open = colors.open
  , close = colors.close

console.log('Foreground colors ..');

assert.equal(colors.white('printed in white'), '\u001b[37mprinted in white\u001b[39m');

assert.equal(colors.black('printed in black'), '\u001b[30mprinted in black\u001b[39m');
assert.equal(colors.brightBlack('printed in bright black'), '\u001b[90mprinted in bright black\u001b[39m');

assert.equal(colors.green('printed in green'), '\u001b[32mprinted in green\u001b[39m');
assert.equal(colors.brightGreen('printed in bright green'), '\u001b[92mprinted in bright green\u001b[39m');

assert.equal(colors.red('printed in red'), '\u001b[31mprinted in red\u001b[39m');
assert.equal(colors.brightRed('printed in bright red'), '\u001b[91mprinted in bright red\u001b[39m');

console.log('OK');

console.log('Background colors ..');

assert.equal(
    colors.bgBlack('printed with black background')
  , '\u001b[40mprinted with black background\u001b[49m'
);

assert.equal(
    colors.bgYellow('printed with yellow background')
  , '\u001b[43mprinted with yellow background\u001b[49m'
);
assert.equal(
    colors.bgBrightYellow('printed with bright yellow background')
  , '\u001b[103mprinted with bright yellow background\u001b[49m'
);

assert.equal(
    colors.bgWhite('printed with white background')
  , '\u001b[47mprinted with white background\u001b[49m'
);

console.log('OK');

console.log('Mixing background and foreground colors ..');

assert.equal(
    colors.blue(colors.bgYellow('printed in blue with yellow background'))
  , '\u001b[34m\u001b[43mprinted in blue with yellow background\u001b[49m\u001b[39m'
);
assert.equal(
    colors.bgYellow(colors.blue('printed in blue with yellow background again'))
  , '\u001b[43m\u001b[34mprinted in blue with yellow background again\u001b[39m\u001b[49m'
);

console.log('OK');

console.log('Open ...');

assert.equal(open.black, '\u001b[30m');
assert.equal(open.bgYellow, '\u001b[43m');

console.log('OK');

console.log('Close ...');

assert.equal(close.black, '\u001b[39m');
assert.equal(close.bgYellow, '\u001b[49m');

console.log('OK');