--
This commit is contained in:
parent
24f3d27984
commit
6b60015c02
9588 changed files with 1149251 additions and 49 deletions
38
node_modules/redeyed/test/redeyed-incomplete.js
generated
vendored
Normal file
38
node_modules/redeyed/test/redeyed-incomplete.js
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
'use strict';
|
||||
/*jshint asi: true*/
|
||||
|
||||
var test = require('tap').test
|
||||
, util = require('util')
|
||||
, redeyed = require('..')
|
||||
|
||||
function inspect (obj) {
|
||||
return util.inspect(obj, false, 5, true)
|
||||
}
|
||||
|
||||
test('adding custom asserts ... ', function (t) {
|
||||
t.constructor.prototype.assertSurrounds = function (code, opts, expected) {
|
||||
var optsi = inspect(opts);
|
||||
var result = redeyed(code, opts).code
|
||||
|
||||
this.equals( result
|
||||
, expected
|
||||
, util.format('%s: %s => %s', optsi, inspect(code), inspect(expected))
|
||||
)
|
||||
return this;
|
||||
}
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('incomplete statement', function (t) {
|
||||
t.test('\n# Keyword', function (t) {
|
||||
var keyconfig = { 'Keyword': { _default: '$:%' } };
|
||||
t.assertSurrounds('if(foo) { x', keyconfig, '$if%(foo) { x')
|
||||
t.assertSurrounds('class Foo { constructor(name)', keyconfig, '$class% Foo { constructor(name)')
|
||||
t.assertSurrounds('const x = ', keyconfig, '$const% x = ')
|
||||
t.assertSurrounds('function g() { yield', keyconfig, '$function% g() { $yield%')
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
Loading…
Reference in a new issue