@@ -211,27 +211,27 @@ function module(ignore, func) {
211
211
*/
212
212
} ;
213
213
214
- // var assert = {
214
+ var assert = {
215
215
216
216
////////////////////////////////////////////////////////////////////////////////
217
217
// GENERAL STATUS
218
218
219
- assert . fail = function ( info ) {
219
+ fail : function ( info ) {
220
220
info = info || "assert.fail()" ;
221
221
fail ( new AssertionError ( info ) ) ;
222
222
} ,
223
223
224
224
////////////////////////////////////////////////////////////////////////////////
225
225
// BOOLEAN TESTS
226
226
227
- assert [ 'true' ] = function ( value ) {
227
+ 'true' : function ( value ) {
228
228
if ( ! value ) {
229
229
fail ( new AssertionError ( "expected truthy, actual " + formatTestValue ( value ) ) ,
230
230
{ Value : value } ) ;
231
231
}
232
232
} ,
233
233
234
- assert [ 'false' ] = function ( value ) {
234
+ 'false' : function ( value ) {
235
235
if ( value ) {
236
236
fail ( new AssertionError ( "expected falsy, actual " + formatTestValue ( value ) ) ,
237
237
{ Value : value } ) ;
@@ -241,38 +241,38 @@ function module(ignore, func) {
241
241
////////////////////////////////////////////////////////////////////////////////
242
242
// SCALAR COMPARISON
243
243
244
- assert . equal = function ( expected , actual ) {
244
+ equal : function ( expected , actual ) {
245
245
if ( expected !== actual ) {
246
246
fail ( new AssertionError ( 'expected: ' + formatTestValue ( expected ) + ', actual: ' + formatTestValue ( actual ) ) ,
247
247
{ Expected : expected , Actual : actual } ) ;
248
248
}
249
249
} ,
250
250
251
- assert . notEqual = function ( expected , actual ) {
251
+ notEqual : function ( expected , actual ) {
252
252
if ( expected === actual ) {
253
253
fail ( new AssertionError ( 'actual was equal to: ' + formatTestValue ( expected ) ) ) ;
254
254
}
255
255
} ,
256
256
257
- assert . greater = function ( lhs , rhs ) {
257
+ greater : function ( lhs , rhs ) {
258
258
if ( lhs <= rhs ) {
259
259
fail ( new AssertionError ( formatTestValue ( lhs ) + ' not greater than ' + formatTestValue ( rhs ) ) ) ;
260
260
}
261
261
} ,
262
262
263
- assert . less = function ( lhs , rhs ) {
263
+ less : function ( lhs , rhs ) {
264
264
if ( lhs >= rhs ) {
265
265
fail ( new AssertionError ( formatTestValue ( lhs ) + ' not less than ' + formatTestValue ( rhs ) ) ) ;
266
266
}
267
267
} ,
268
268
269
- assert . greaterOrEqual = function ( lhs , rhs ) {
269
+ greaterOrEqual : function ( lhs , rhs ) {
270
270
if ( lhs < rhs ) {
271
271
fail ( new AssertionError ( formatTestValue ( lhs ) + ' not greater than or equal to ' + formatTestValue ( rhs ) ) ) ;
272
272
}
273
273
} ,
274
274
275
- assert . lessOrEqual = function ( lhs , rhs ) {
275
+ lessOrEqual : function ( lhs , rhs ) {
276
276
if ( lhs > rhs ) {
277
277
fail ( new AssertionError ( formatTestValue ( lhs ) + ' not less than or equal to ' + formatTestValue ( rhs ) ) ) ;
278
278
}
@@ -281,14 +281,14 @@ function module(ignore, func) {
281
281
////////////////////////////////////////////////////////////////////////////////
282
282
// DEEP COMPARISON
283
283
284
- assert . deepEqual = function ( expected , actual ) {
284
+ deepEqual : function ( expected , actual ) {
285
285
if ( ! _ . isEqual ( expected , actual ) ) {
286
286
fail ( new AssertionError ( 'expected: ' + formatTestValue ( expected ) + ', actual: ' + formatTestValue ( actual ) ) ,
287
287
{ Expected : expected , Actual : actual } ) ;
288
288
}
289
289
} ,
290
290
291
- assert . notDeepEqual = function ( expected , actual ) {
291
+ notDeepEqual : function ( expected , actual ) {
292
292
if ( _ . isEqual ( expected , actual ) ) {
293
293
fail ( new AssertionError ( 'expected: ' + formatTestValue ( expected ) + ' and actual: ' + formatTestValue ( actual ) + ' were equal' ) ) ;
294
294
}
@@ -297,7 +297,7 @@ function module(ignore, func) {
297
297
////////////////////////////////////////////////////////////////////////////////
298
298
// FLOATING POINT
299
299
300
- assert . nearEqual = function ( expected , actual , tolerance ) {
300
+ nearEqual : function ( expected , actual , tolerance ) {
301
301
if ( tolerance === undefined ) {
302
302
tolerance = 0.0 ;
303
303
}
@@ -318,21 +318,21 @@ function module(ignore, func) {
318
318
////////////////////////////////////////////////////////////////////////////////
319
319
// STRING
320
320
321
- assert . inString = function ( expected , string ) {
321
+ inString : function ( expected , string ) {
322
322
if ( - 1 === string . indexOf ( expected ) ) {
323
323
fail ( new AssertionError ( 'expected: ' + formatTestValue ( expected ) + ' not in string: ' + formatTestValue ( string ) ) ,
324
324
{ Expected : expected , 'String' : string } ) ;
325
325
}
326
326
} ,
327
327
328
- assert . notInString = function ( expected , string ) {
328
+ notInString : function ( expected , string ) {
329
329
if ( - 1 !== string . indexOf ( expected ) ) {
330
330
fail ( new AssertionError ( 'unexpected: ' + formatTestValue ( expected ) + ' in string: ' + formatTestValue ( string ) ) ,
331
331
{ Expected : expected , 'String' : string } ) ;
332
332
}
333
333
} ,
334
334
335
- assert . matches = function ( re , string ) {
335
+ matches : function ( re , string ) {
336
336
if ( ! re . test ( string ) ) {
337
337
fail ( new AssertionError ( 'regexp ' + re + ' does not match: ' + string ) ) ;
338
338
}
@@ -341,7 +341,7 @@ function module(ignore, func) {
341
341
////////////////////////////////////////////////////////////////////////////////
342
342
// ARRAY
343
343
344
- assert . inArray = function ( expected , array ) {
344
+ inArray : function ( expected , array ) {
345
345
var found = false ;
346
346
_ . each ( array , function ( element ) {
347
347
if ( _ . isEqual ( expected , element ) ) {
@@ -354,7 +354,7 @@ function module(ignore, func) {
354
354
}
355
355
} ,
356
356
357
- assert . notInArray = function ( expected , array ) {
357
+ notInArray : function ( expected , array ) {
358
358
var found = false ;
359
359
_ . each ( array , function ( element ) {
360
360
if ( _ . isEqual ( expected , element ) ) {
@@ -370,13 +370,13 @@ function module(ignore, func) {
370
370
////////////////////////////////////////////////////////////////////////////////
371
371
// OBJECTS
372
372
373
- assert . hasKey = function ( key , object ) {
373
+ hasKey : function ( key , object ) {
374
374
if ( ! ( key in object ) ) {
375
375
fail ( new AssertionError ( 'Key ' + formatTestValue ( key ) + ' is not in object: ' + formatTestValue ( object ) ) ) ;
376
376
}
377
377
} ,
378
378
379
- assert . notHasKey = function ( key , object ) {
379
+ notHasKey : function ( key , object ) {
380
380
if ( key in object ) {
381
381
fail ( new AssertionError ( 'Unexpected key ' + formatTestValue ( key ) + ' is found in object: ' + formatTestValue ( object ) ) ) ;
382
382
}
@@ -385,7 +385,7 @@ function module(ignore, func) {
385
385
////////////////////////////////////////////////////////////////////////////////
386
386
// EXCEPTIONS
387
387
388
- assert . throws = function ( exception , fn ) {
388
+ throws : function ( exception , fn ) {
389
389
try {
390
390
fn ( ) ;
391
391
} catch ( e ) {
@@ -401,7 +401,7 @@ function module(ignore, func) {
401
401
////////////////////////////////////////////////////////////////////////////////
402
402
// TYPE
403
403
404
- assert [ 'instanceof' ] = function ( actual , type ) {
404
+ 'instanceof' : function ( actual , type ) {
405
405
if ( ! ( actual instanceof type ) ) {
406
406
fail ( new AssertionError ( formatTestValue ( actual ) + ' not instance of ' + formatTestValue ( type ) ) ,
407
407
{ Type : type , Actual : actual } ) ;
@@ -412,7 +412,7 @@ function module(ignore, func) {
412
412
// DOM ASSERTIONS
413
413
414
414
// TODO: lift into separate file?
415
- assert . dom = {
415
+ dom : {
416
416
present : function ( domElement ) {
417
417
if ( ! $ ( domElement ) . length ) {
418
418
fail ( new AssertionError ( decipherDomElement ( domElement ) + ' should be present' ) ) ;
@@ -539,8 +539,8 @@ function module(ignore, func) {
539
539
fail ( new AssertionError ( decipherDomElement ( el ) + ' expected NOT to be empty' ) ) ;
540
540
}
541
541
}
542
- } ;
543
- // };
542
+ }
543
+ } ;
544
544
545
545
function decipherDomElement ( selectorOrJQueryObject ) {
546
546
if ( typeof selectorOrJQueryObject === 'string' ) {
0 commit comments