Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

break.js 814B

1234567891011121314151617181920212223242526272829303132
  1. var test = require('tape');
  2. var wordwrap = require('../');
  3. test('hard', function (t) {
  4. var s = 'Assert from {"type":"equal","ok":false,"found":1,"wanted":2,'
  5. + '"stack":[],"id":"b7ddcd4c409de8799542a74d1a04689b",'
  6. + '"browser":"chrome/6.0"}'
  7. ;
  8. var s_ = wordwrap.hard(80)(s);
  9. var lines = s_.split('\n');
  10. t.equal(lines.length, 2);
  11. t.ok(lines[0].length < 80);
  12. t.ok(lines[1].length < 80);
  13. t.equal(s, s_.replace(/\n/g, ''));
  14. t.end();
  15. });
  16. test('break', function (t) {
  17. var s = new Array(55+1).join('a');
  18. var s_ = wordwrap.hard(20)(s);
  19. var lines = s_.split('\n');
  20. t.equal(lines.length, 3);
  21. t.ok(lines[0].length === 20);
  22. t.ok(lines[1].length === 20);
  23. t.ok(lines[2].length === 15);
  24. t.equal(s, s_.replace(/\n/g, ''));
  25. t.end();
  26. });