Sha256: 2a16a5d2d50ce9b5450b40707b8db6cd0c4fb113f94c5f7e8a3ee9ff4ce382f8

Contents?: true

Size: 1.55 KB

Versions: 72

Compression:

Stored size: 1.55 KB

Contents

'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('\n undefineds only', function (t) {
  t.assertSurrounds('1 + 2', { Numeric: { _default: undefined } }, '1 + 2')
  t.assertSurrounds('1 + 2', { Numeric: { _default: undefined }, _default: undefined }, '1 + 2')

  t.assertSurrounds(
      'return true'
    , { 'Boolean': { 'true': undefined, 'false': undefined, _default: undefined } , _default: undefined }
    , 'return true'
  )

  t.end()
})

test('\n mixed', function (t) {
  t.assertSurrounds(
      'return true || false'
    , { 'Boolean': { 'true': '&:', 'false': undefined, _default: undefined } , _default: undefined }
    , 'return &true || false'
  )

  t.assertSurrounds(
      'return true || false'
    , { 'Boolean': { 'true': '&:', 'false': undefined, _default: ':?' } , _default: undefined }
    , 'return &true? || false?'
  )

  t.assertSurrounds(
      'return true || false'
    , { 'Boolean': { 'true': '&:', 'false': undefined, _default: undefined } , _default: ':?' }
    , 'return &true? || false'
  )
  
  t.end()
})

Version data entries

72 entries across 72 versions & 3 rubygems

Version Path
ilog-0.4.1 node_modules/redeyed/test/redeyed-config-with-undefineds.js
ilog-0.4.0 node_modules/redeyed/test/redeyed-config-with-undefineds.js
ilog-0.3.3 node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js