1
0
Fork 0

All tests now using common.require() to prepare for client-side testing

closure/master
Mike Gerwitz 2010-12-21 23:25:12 -05:00
parent a3cf31aa40
commit 98fd1e7c7c
15 changed files with 65 additions and 59 deletions

View File

@ -22,5 +22,25 @@
* @package test * @package test
*/ */
// may be implemented in the future /**
* Library path
* @type {string}
*/
exports.PATH_LIB = require( 'path' ).normalize( __dirname + '/../lib' );
/**
* Returns requested module from the library path
*
* This method abstracts require() implementation so that the tests may be more
* easily implemented elsewhere (e.g. client-side)
*
* @param {string} module module id
*
* @return {Object} module exports
*/
exports.require = function( module )
{
return require( exports.PATH_LIB + '/' + module );
}

View File

@ -22,12 +22,11 @@
* @package test * @package test
*/ */
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), Class = common.require( 'class' ),
Class = require( '../lib/class' ), abstractMethod = common.require( 'class' ).abstractMethod,
abstractMethod = require( '../lib/class' ).abstractMethod, util = common.require( 'util' );
util = require( '../lib/util' );
// not abstract // not abstract
var Foo = Class.extend( {} ); var Foo = Class.extend( {} );

View File

@ -22,10 +22,9 @@
* @package test * @package test
*/ */
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), Class = common.require( 'class' );
Class = require( '../lib/class' );
// these two variables are declared outside of the class to ensure that they // these two variables are declared outside of the class to ensure that they
// will still be set even if the context of the constructor is wrong // will still be set even if the context of the constructor is wrong

View File

@ -22,10 +22,9 @@
* @package test * @package test
*/ */
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), Class = common.require( 'class' );
Class = require( '../lib/class' );
var foo_props = { var foo_props = {
one: 1, one: 1,

View File

@ -28,10 +28,9 @@ if ( Object.prototype.__defineGetter__ === undefined )
return; return;
} }
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), Class = common.require( 'class' );
Class = require( '../lib/class' );
var Foo = Class.extend( var Foo = Class.extend(

View File

@ -22,10 +22,9 @@
* @package test * @package test
*/ */
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), Class = common.require( 'class' );
Class = require( '../lib/class' );
var Foo = Class.extend( var Foo = Class.extend(
{ {

View File

@ -22,10 +22,9 @@
* @package test * @package test
*/ */
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), Class = common.require( 'class' );
Class = require( '../lib/class' );
assert.ok( assert.ok(

View File

@ -22,10 +22,9 @@
* @package test * @package test
*/ */
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), Class = common.require( 'class' ),
Class = require( '../lib/class' ),
Script = process.binding( 'evals' ).Script, Script = process.binding( 'evals' ).Script,
sandbox = {}; sandbox = {};

View File

@ -22,10 +22,9 @@
* @package test * @package test
*/ */
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), Class = common.require( 'class' ),
Class = require( '../lib/class' ),
index = require( '../' ); index = require( '../' );

View File

@ -22,10 +22,9 @@
* @package test * @package test
*/ */
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), Interface = common.require( 'interface' ),
Interface = require( '../lib/interface' ),
abstractMethod = Interface.abstractMethod; abstractMethod = Interface.abstractMethod;

View File

@ -22,10 +22,9 @@
* @package test * @package test
*/ */
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), Interface = common.require( 'interface' ),
Interface = require( '../lib/interface' ),
abstractMethod = Interface.abstractMethod; abstractMethod = Interface.abstractMethod;
var FooType = Interface.extend(); var FooType = Interface.extend();

View File

@ -22,10 +22,9 @@
* @package test * @package test
*/ */
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), util = common.require( 'util' );
util = require( '../lib/util' );
var arr = [ 1, 2, 3 ], var arr = [ 1, 2, 3 ],
obj = { a: 1, b: 2 }; obj = { a: 1, b: 2 };

View File

@ -22,10 +22,9 @@
* @package test * @package test
*/ */
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), util = common.require( 'util' );
util = require( '../lib/util' );
var obj = {}, var obj = {},
val = 'bar'; val = 'bar';

View File

@ -22,10 +22,9 @@
* @package test * @package test
*/ */
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), propCopy = common.require( 'util' ).propCopy;
propCopy = require( '../lib/util' ).propCopy;
var props = { var props = {
one: 1, one: 1,

View File

@ -22,10 +22,9 @@
* @package test * @package test
*/ */
require( './common' ); var common = require( './common' ),
assert = require( 'assert' ),
var assert = require( 'assert' ), util = common.require( 'util' );
util = require( '../lib/util' );
var data = { var data = {
// scalars (properties) // scalars (properties)