コード例 #1
0
ファイル: test.js プロジェクト: pdehaan/line-length.js
var test = require('tape');

function runTest(description, main) {
  test(description, function(t) {
    t.plan(3);

    t.deepEqual(
      main('a\r\nbc\n'),
      [1, 2, 0],
      'should get line length of a string.'
    );

    t.throws(
      main.bind(null, ['foo']), /TypeError.*not a string/,
      'should throw a type error when it takes a non-string argument.'
    );

    t.throws(
      main.bind(null), /TypeError.*No arguments/,
      'should throw a type error when it takes no arguments.'
    );
  });
}

runTest('require(\'line-length\')', require('./'));

global.window = {};
requireBowerFiles({self: true});

runTest('window.lineLength', window.lineLength);
コード例 #2
0
ファイル: test.js プロジェクト: shinnn/all-font-face-attrs
test('window.allFontFaceAttrs', t => {
  global.window = {};
  requireBowerFiles({self: true});
  t.deepEqual(global.window.allFontFaceAttrs, expected, spec);
  t.end();
});