Initial commit
This commit is contained in:
3
node/TestCli/node_modules/figlet/test/expected/.gitattributes
generated
vendored
Normal file
3
node/TestCli/node_modules/figlet/test/expected/.gitattributes
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# these files are always checked out with lf only, required
|
||||
# for tests to pass on windows
|
||||
* text eol=lf
|
||||
7
node/TestCli/node_modules/figlet/test/expected/dancingFont
generated
vendored
Normal file
7
node/TestCli/node_modules/figlet/test/expected/dancingFont
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
____ _____ _____ _ ____ U _____ u
|
||||
U| _"\ u ___ |"_ /u |"_ /u U /"\ u U| _"\ u ___ \| ___"|/
|
||||
\| |_) |/ |_"_| U / // U / // \/ _ \/ \| |_) |/ |_"_| | _|"
|
||||
| __/ | | \/ /_ \/ /_ / ___ \ | __/ | | | |___
|
||||
|_| U/| |\u /____| /____| /_/ \_\ |_| U/| |\u |_____|
|
||||
||>>_ .-,_|___|_,-. _//<<,- _//<<,- \\ >> ||>>_ .-,_|___|_,-. << >>
|
||||
(__)__) \_)-' '-(_/ (__) (_/ (__) (_/ (__) (__) (__)__) \_)-' '-(_/ (__) (__)
|
||||
7
node/TestCli/node_modules/figlet/test/expected/dancingFontReverse
generated
vendored
Normal file
7
node/TestCli/node_modules/figlet/test/expected/dancingFontReverse
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
U _____ u ____ _ _____ _____ ____
|
||||
\| ___"|/ ___ U| _"\ u U /"\ u |"_ /u |"_ /u ___ U| _"\ u
|
||||
| _|" |_"_| \| |_) |/ \/ _ \/ U / // U / // |_"_| \| |_) |/
|
||||
| |___ | | | __/ / ___ \ \/ /_ \/ /_ | | | __/
|
||||
|_____| U/| |\u |_| /_/ \_\ /____| /____| U/| |\u |_|
|
||||
<< >> .-,_|___|_,-. ||>>_ \\ >> _//<<,- _//<<,- .-,_|___|_,-. ||>>_
|
||||
(__) (__) \_)-' '-(_/ (__)__) (__) (__) (__) (_/ (__) (_/ \_)-' '-(_/ (__)__)
|
||||
6
node/TestCli/node_modules/figlet/test/expected/graffiti
generated
vendored
Normal file
6
node/TestCli/node_modules/figlet/test/expected/graffiti
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
_____ __________ _________ ____ ________ ________
|
||||
/ _ \ \______ \\_ ___ \ /_ |\_____ \ \_____ \
|
||||
/ /_\ \ | | _// \ \/ | | / ____/ _(__ <
|
||||
/ | \| | \\ \____ | |/ \ / \
|
||||
\____|__ /|______ / \______ / /\ |___|\_______ \/______ /
|
||||
\/ \/ \/ \/ \/ \/
|
||||
11
node/TestCli/node_modules/figlet/test/expected/standard
generated
vendored
Normal file
11
node/TestCli/node_modules/figlet/test/expected/standard
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
_____ ___ ____ _ _
|
||||
| ___|_ _/ ___| | ___| |_
|
||||
| |_ | | | _| |/ _ \ __|
|
||||
| _| | | |_| | | __/ |_
|
||||
|_| |___\____|_|\___|\__|
|
||||
_____ ___ _ _ _____ ____
|
||||
| ___/ _ \| \ | |_ _/ ___|
|
||||
| |_ | | | | \| | | | \___ \
|
||||
| _|| |_| | |\ | | | ___) |
|
||||
|_| \___/|_| \_| |_| |____/
|
||||
|
||||
10
node/TestCli/node_modules/figlet/test/expected/verticalSmushRule2
generated
vendored
Normal file
10
node/TestCli/node_modules/figlet/test/expected/verticalSmushRule2
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
______ _ __
|
||||
/_ __/__ _________ ___ (_)___ ____ _/ /
|
||||
/ / / _ \/ ___/ __ `__ \/ / __ \/ __ `/ /
|
||||
/ / / __/ / / / / / / / / / / / /_/ / /
|
||||
/_/__\___/_/ /_/ /_/ /_/_/_/ /_/\__,_/_/
|
||||
/ ____/ /_ ___ __________
|
||||
/ / / __ \/ _ \/ ___/ ___/
|
||||
/ /___/ / / / __(__ |__ )
|
||||
\____/_/ /_/\___/____/____/
|
||||
|
||||
10
node/TestCli/node_modules/figlet/test/expected/wrapSimple
generated
vendored
Normal file
10
node/TestCli/node_modules/figlet/test/expected/wrapSimple
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
_ _ _ _ _____ _____ _ _____ _
|
||||
| | | | ___| | | ___ | ___| __ ___ _ __ ___ |_ _| |__ ___ | ___(_)
|
||||
| |_| |/ _ \ | |/ _ \ | |_ | '__/ _ \| '_ ` _ \ | | | '_ \ / _ \ | |_ | |
|
||||
| _ | __/ | | (_) | | _|| | | (_) | | | | | | | | | | | | __/ | _| | |
|
||||
|_| |_|\___|_|_|\___/ |_|_ |_| \___/|_| |_| |_| |_| |_| |_|\___| |_| |_|
|
||||
__ _| | ___| |_ | | (_) |__ _ __ __ _ _ __ _ _
|
||||
/ _` | |/ _ \ __| | | | | '_ \| '__/ _` | '__| | | |
|
||||
| (_| | | __/ |_ | |___| | |_) | | | (_| | | | |_| |
|
||||
\__, |_|\___|\__| |_____|_|_.__/|_| \__,_|_| \__, |
|
||||
|___/ |___/
|
||||
15
node/TestCli/node_modules/figlet/test/expected/wrapSimpleThreeLines
generated
vendored
Normal file
15
node/TestCli/node_modules/figlet/test/expected/wrapSimpleThreeLines
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
_ _ _ _ _____ _____ _ _____ _
|
||||
| | | | ___| | | ___ | ___| __ ___ _ __ ___ |_ _| |__ ___ | ___(_)
|
||||
| |_| |/ _ \ | |/ _ \ | |_ | '__/ _ \| '_ ` _ \ | | | '_ \ / _ \ | |_ | |
|
||||
| _ | __/ | | (_) | | _|| | | (_) | | | | | | | | | | | | __/ | _| | |
|
||||
|_| |_|\___|_|_|\___/ |_|_ |_| \___/|_| |_| |_| |_| |_|_|_|\___| |_| |_|
|
||||
__ _| | ___| |_ | | (_) |__ _ __ __ _ _ __ _ _ |_ _| |__ __ _
|
||||
/ _` | |/ _ \ __| | | | | '_ \| '__/ _` | '__| | | | | | | '_ \ / _` |
|
||||
| (_| | | __/ |_ | |___| | |_) | | | (_| | | | |_| | | | | | | | (_| |
|
||||
\__, |_|\___|\__| |_____|_|_.__/|_| \__,_|_| \__, | |_| |_| |_|\__,_|
|
||||
|___/__ __ _____ |___/
|
||||
| |_ \ \ / / __ __ _ _ __ |_ _|____ _| |_
|
||||
| __| \ \ /\ / / '__/ _` | '_ \ | |/ _ \ \/ / __|
|
||||
| |_ \ V V /| | | (_| | |_) | | | __/> <| |_
|
||||
\__| \_/\_/ |_| \__,_| .__/ |_|\___/_/\_\\__|
|
||||
|_|
|
||||
30
node/TestCli/node_modules/figlet/test/expected/wrapWhitespaceBreakWord
generated
vendored
Normal file
30
node/TestCli/node_modules/figlet/test/expected/wrapWhitespaceBreakWord
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
_ _ _ _
|
||||
| | | | ___| | | ___
|
||||
| |_| |/ _ \ | |/ _ \
|
||||
| _ | __/ | | (_) |
|
||||
|_| |_|\___|_|_|\___/
|
||||
| | ___ _ __ __ _
|
||||
| | / _ \| '_ \ / _` |
|
||||
| |__| (_) | | | | (_| |
|
||||
|_____\___/|_| |_|\__, |
|
||||
| | ___ _ __ |___/
|
||||
| | / _ \| '_ \ / _` |
|
||||
| |__| (_) | | | | (_| |
|
||||
|_____\___/|_| |_|\__, |
|
||||
| | ___ _ __ |___/
|
||||
| | / _ \| '_ \ / _` |
|
||||
| |__| (_) | | | | (_| |
|
||||
|_____\___/|_| |_|\__, |_
|
||||
\ \ / /__ _ |___/| |
|
||||
\ \ /\ / / _ \| '__/ _` |
|
||||
_\ V V / (_) | | | (_| |
|
||||
| |\_/\_/_\___/|_| _\__,_|__
|
||||
| | / _ \| '_ \ / _` |/ _ \
|
||||
| |__| (_) | | | | (_| | __/
|
||||
|_____\___/|_| |_|\__, |\___|
|
||||
_ _|___/
|
||||
_ __| |__ ___| | | ___
|
||||
| '__| '_ \ / _ \ | |/ _ \
|
||||
| | | | | | __/ | | (_) |
|
||||
|_| |_| |_|\___|_|_|\___/
|
||||
|
||||
21
node/TestCli/node_modules/figlet/test/expected/wrapWhitespaceLogString
generated
vendored
Normal file
21
node/TestCli/node_modules/figlet/test/expected/wrapWhitespaceLogString
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
__ ____ ____ ____ __
|
||||
\ \/ /\ \/ /\ \/ /\ \/ /
|
||||
> < > < > < > <
|
||||
/_/\_\/_/\_\/_/\_\/_/\_\
|
||||
\ \/ /\ \/ /\ \/ /\ \/ /
|
||||
> < > < > < > <
|
||||
/_/\_\/_/\_\/_/\_\/_/\_\
|
||||
\ \/ /\ \/ /\ \/ /\ \/ /
|
||||
> < > < > < > <
|
||||
/_/\_\/_/\_\/_/\_\/_/\_\
|
||||
\ \/ /\ \/ /\ \/ /\ \/ /
|
||||
> < > < > < > <
|
||||
/_/\_\/_/\_\/_/\_\/_/\_\
|
||||
\ \/ /\ \/ /\ \/ /\ \/ /
|
||||
> < > < > < > <
|
||||
/_/\_\/_/\_\/_/\_\/_/\_\
|
||||
\ \/ /\ \/ /\ \/ /\ \/ /
|
||||
> < > < > < > <
|
||||
/_/\_\/_/\_\/_/\_\/_/\_\
|
||||
|
||||
10
node/TestCli/node_modules/figlet/test/expected/wrapWord
generated
vendored
Normal file
10
node/TestCli/node_modules/figlet/test/expected/wrapWord
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
_ _ _ _ _____ _____ _
|
||||
| | | | ___| | | ___ | ___| __ ___ _ __ ___ |_ _| |__ ___
|
||||
| |_| |/ _ \ | |/ _ \ | |_ | '__/ _ \| '_ ` _ \ | | | '_ \ / _ \
|
||||
| _ | __/ | | (_) | | _|| | | (_) | | | | | | | | | | | | __/
|
||||
|_|_|_|\___|_|_|\___/ _|_| |_| \___/|_| |_| |_| |_| |_| |_|\___|
|
||||
| ___(_) __ _| | ___| |_ | | (_) |__ _ __ __ _ _ __ _ _
|
||||
| |_ | |/ _` | |/ _ \ __| | | | | '_ \| '__/ _` | '__| | | |
|
||||
| _| | | (_| | | __/ |_ | |___| | |_) | | | (_| | | | |_| |
|
||||
|_| |_|\__, |_|\___|\__| |_____|_|_.__/|_| \__,_|_| \__, |
|
||||
|___/ |___/
|
||||
15
node/TestCli/node_modules/figlet/test/expected/wrapWordThreeLines
generated
vendored
Normal file
15
node/TestCli/node_modules/figlet/test/expected/wrapWordThreeLines
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
_ _ _ _ _____ _____ _
|
||||
| | | | ___| | | ___ | ___| __ ___ _ __ ___ |_ _| |__ ___
|
||||
| |_| |/ _ \ | |/ _ \ | |_ | '__/ _ \| '_ ` _ \ | | | '_ \ / _ \
|
||||
| _ | __/ | | (_) | | _|| | | (_) | | | | | | | | | | | | __/
|
||||
|_|_|_|\___|_|_|\___/ _|_| |_| \___/|_| |_| |_| |_| |_| |_|\___|
|
||||
| ___(_) __ _| | ___| |_ | | (_) |__ _ __ __ _ _ __ _ _
|
||||
| |_ | |/ _` | |/ _ \ __| | | | | '_ \| '__/ _` | '__| | | |
|
||||
| _| | | (_| | | __/ |_ | |___| | |_) | | | (_| | | | |_| |
|
||||
|_| |_|\__, |_|\___|\__| |_____|_|_.__/|_| \__,_|_| \__, |
|
||||
_____ _ |___/ _ __ __ ____|___/ _
|
||||
|_ _| |__ __ _| |_ \ \ / / __ __ _ _ __ |_ _|____ _| |_
|
||||
| | | '_ \ / _` | __| \ \ /\ / / '__/ _` | '_ \ | |/ _ \ \/ / __|
|
||||
| | | | | | (_| | |_ \ V V /| | | (_| | |_) | | | __/> <| |_
|
||||
|_| |_| |_|\__,_|\__| \_/\_/ |_| \__,_| .__/ |_|\___/_/\_\\__|
|
||||
|_|
|
||||
255
node/TestCli/node_modules/figlet/test/figlet_test.js
generated
vendored
Normal file
255
node/TestCli/node_modules/figlet/test/figlet_test.js
generated
vendored
Normal file
@@ -0,0 +1,255 @@
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
var figlet = require('../lib/node-figlet'),
|
||||
grunt = require('grunt'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
async = require('async');
|
||||
|
||||
/*
|
||||
======== A Handy Little Nodeunit Reference ========
|
||||
https://github.com/caolan/nodeunit
|
||||
|
||||
Test methods:
|
||||
test.expect(numAssertions)
|
||||
test.done()
|
||||
Test assertions:
|
||||
test.ok(value, [message])
|
||||
test.equal(actual, expected, [message])
|
||||
test.notEqual(actual, expected, [message])
|
||||
test.deepEqual(actual, expected, [message])
|
||||
test.notDeepEqual(actual, expected, [message])
|
||||
test.strictEqual(actual, expected, [message])
|
||||
test.notStrictEqual(actual, expected, [message])
|
||||
test.throws(block, [error], [message])
|
||||
test.doesNotThrow(block, [error], [message])
|
||||
test.ifError(value)
|
||||
*/
|
||||
|
||||
exports.figlet = {
|
||||
setUp: function(done) {
|
||||
// setup here if necessary
|
||||
done();
|
||||
},
|
||||
standard: function(test) {
|
||||
test.expect(1);
|
||||
|
||||
figlet('FIGlet\nFONTS', {
|
||||
font: 'Standard',
|
||||
verticalLayout: 'fitted'
|
||||
}, function(err, actual) {
|
||||
var expected = grunt.file.read('test/expected/standard');
|
||||
test.equal(actual, expected, 'Standard font with a vertical layout of "fitted".');
|
||||
|
||||
test.done();
|
||||
});
|
||||
},
|
||||
standardSync: function(test) {
|
||||
test.expect(1);
|
||||
|
||||
var expected = grunt.file.read('test/expected/standard');
|
||||
var actual = figlet.textSync('FIGlet\nFONTS', {font: 'Standard', verticalLayout: 'fitted'});
|
||||
|
||||
test.equal(actual, expected, 'Standard font with a vertical layout of "fitted".');
|
||||
|
||||
test.done();
|
||||
},
|
||||
standardParse: function(test) {
|
||||
test.expect(1);
|
||||
|
||||
var expected = grunt.file.read('test/expected/standard');
|
||||
var data = fs.readFileSync(path.join(__dirname, '../fonts/Standard.flf'), 'utf8');
|
||||
var font = figlet.parseFont('StandardParseFontName', data);
|
||||
var actual = figlet.textSync('FIGlet\nFONTS', {font: 'StandardParseFontName', verticalLayout: 'fitted'});
|
||||
|
||||
test.equal(actual, expected, 'Standard font with a vertical layout of "fitted" loaded using parseFont().');
|
||||
|
||||
test.done();
|
||||
},
|
||||
graffiti: function(test) {
|
||||
test.expect(1);
|
||||
|
||||
figlet.text('ABC.123', {
|
||||
font: 'Graffiti',
|
||||
horizontalLayout: 'fitted'
|
||||
}, function(err, actual) {
|
||||
var expected = grunt.file.read('test/expected/graffiti');
|
||||
test.equal(actual, expected, 'Graffiti font with a horizontal layout of "fitted".');
|
||||
|
||||
test.done();
|
||||
});
|
||||
},
|
||||
graffitiSync: function(test) {
|
||||
test.expect(1);
|
||||
|
||||
var expected = grunt.file.read('test/expected/graffiti');
|
||||
var actual = figlet.textSync('ABC.123', {font: 'Graffiti', horizontalLayout: 'fitted'});
|
||||
test.equal(actual, expected, 'Graffiti font with a horizontal layout of "fitted".');
|
||||
|
||||
test.done();
|
||||
},
|
||||
wrap: function(test) {
|
||||
test.expect(4);
|
||||
var specs = [
|
||||
{
|
||||
input: 'Hello From The Figlet Library',
|
||||
expected: grunt.file.read('test/expected/wrapSimple')
|
||||
},
|
||||
{
|
||||
input: 'Hello From The Figlet Library That Wrap Text',
|
||||
expected: grunt.file.read('test/expected/wrapSimpleThreeLines')
|
||||
}
|
||||
];
|
||||
(function recur() {
|
||||
var spec = specs.pop();
|
||||
if (!spec) {
|
||||
test.done();
|
||||
} else {
|
||||
figlet(spec.input, {
|
||||
font: 'Standard',
|
||||
width: 80
|
||||
}, function(err, actual) {
|
||||
var maxWidth = actual.split('\n').reduce(function(acc, line) {
|
||||
if (acc < line.length) {
|
||||
return line.length;
|
||||
}
|
||||
return acc;
|
||||
}, 0);
|
||||
test.equal(maxWidth <= 80, true);
|
||||
test.equal(actual, spec.expected, 'Standard font with wrap.');
|
||||
recur();
|
||||
});
|
||||
}
|
||||
})();
|
||||
},
|
||||
wrapBreakWord: function(test) {
|
||||
test.expect(10);
|
||||
var specs = [
|
||||
{
|
||||
input: 'Hello From The Figlet Library',
|
||||
expected: grunt.file.read('test/expected/wrapWord'),
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
input: 'Hello From The Figlet Library That Wrap Text',
|
||||
expected: grunt.file.read('test/expected/wrapWordThreeLines'),
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
input: 'Hello From The Figlet Library That Wrap Text',
|
||||
expected: grunt.file.read('test/expected/wrapWordThreeLines'),
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
input: 'Hello LongLongLong Word Longerhello',
|
||||
expected: grunt.file.read('test/expected/wrapWhitespaceBreakWord'),
|
||||
width: 30
|
||||
},
|
||||
{
|
||||
input: 'xxxxxxxxxxxxxxxxxxxxxxxx',
|
||||
expected: grunt.file.read('test/expected/wrapWhitespaceLogString'),
|
||||
width: 30
|
||||
}
|
||||
];
|
||||
(function recur() {
|
||||
var spec = specs.pop();
|
||||
if (!spec) {
|
||||
test.done();
|
||||
} else {
|
||||
var width = spec.width;
|
||||
figlet(spec.input, {
|
||||
font: 'Standard',
|
||||
width: width,
|
||||
whitespaceBreak: true
|
||||
}, function(err, actual) {
|
||||
var maxWidth = actual.split('\n').reduce(function(acc, line) {
|
||||
if (acc < line.length) {
|
||||
return line.length;
|
||||
}
|
||||
return acc;
|
||||
}, 0);
|
||||
test.equal(maxWidth <= width, true);
|
||||
test.equal(actual, spec.expected, 'Standard font with word break.');
|
||||
recur();
|
||||
});
|
||||
}
|
||||
})();
|
||||
},
|
||||
dancingFont: function(test) {
|
||||
test.expect(1);
|
||||
|
||||
figlet.text('pizzapie', {
|
||||
font: 'Dancing Font',
|
||||
horizontalLayout: 'full'
|
||||
}, function(err, actual) {
|
||||
|
||||
var expected = grunt.file.read('test/expected/dancingFont');
|
||||
test.equal(actual, expected, 'Dancing Font with a horizontal layout of "full".');
|
||||
|
||||
test.done();
|
||||
});
|
||||
},
|
||||
dancingFontSync: function(test) {
|
||||
test.expect(1);
|
||||
|
||||
var expected = grunt.file.read('test/expected/dancingFont');
|
||||
var actual = figlet.textSync('pizzapie', {font: 'Dancing Font', horizontalLayout: 'full'});
|
||||
test.equal(actual, expected, 'Dancing Font with a horizontal layout of "full".');
|
||||
|
||||
test.done();
|
||||
},
|
||||
verticalSmushRule2: function(test) {
|
||||
test.expect(1);
|
||||
|
||||
var expected = grunt.file.read('test/expected/verticalSmushRule2');
|
||||
var actual = figlet.textSync('Terminal\nChess', {font: 'Slant'});
|
||||
test.equal(actual, expected, 'Vertical Smush Rule 2 should be followed.');
|
||||
|
||||
test.done();
|
||||
},
|
||||
printDirection: function(test) {
|
||||
test.expect(1);
|
||||
|
||||
figlet.text('pizzapie', {
|
||||
font: 'Dancing Font',
|
||||
horizontalLayout: 'full',
|
||||
printDirection: 1
|
||||
}, function(err, actual) {
|
||||
|
||||
var expected = grunt.file.read('test/expected/dancingFontReverse');
|
||||
test.equal(actual, expected, 'Dancing Font with a reversed print direction.');
|
||||
|
||||
test.done();
|
||||
});
|
||||
},
|
||||
/*
|
||||
This test ensures that all fonts will load without error
|
||||
*/
|
||||
loadAll: function(test) {
|
||||
var errCount = 0;
|
||||
test.expect(1);
|
||||
|
||||
figlet.fonts(function(err, fonts) {
|
||||
if (err) {
|
||||
errCount++;
|
||||
return;
|
||||
}
|
||||
|
||||
async.eachSeries(fonts, function(font, next) {
|
||||
figlet.text('abc ABC ...', {
|
||||
font: font
|
||||
}, function(err, data) {
|
||||
if (err) {
|
||||
errCount++;
|
||||
}
|
||||
next();
|
||||
});
|
||||
}, function(err) {
|
||||
test.equal(errCount, 0, 'A problem occurred while testing one of the fonts.');
|
||||
test.done();
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user