From c1207eb3d53949ac7b5c7864ec51d7336c046039 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 20 Oct 2011 23:40:30 -0400 Subject: [PATCH] Moved MemberBuilder-MethodTest into MemberBuilder subdir - Altered combine script to support subdirs (note that the dir names aren't included in the combined file) --- test/Makefile | 2 +- .../MethodTest.js} | 4 ++-- tools/combine | 6 +++--- tools/combine.tpl | 5 +++-- 4 files changed, 9 insertions(+), 8 deletions(-) rename test/{MemberBuilder-MethodTest.js => MemberBuilder/MethodTest.js} (98%) diff --git a/test/Makefile b/test/Makefile index 62f353e..584a4b9 100644 --- a/test/Makefile +++ b/test/Makefile @@ -13,6 +13,6 @@ default: $(tests) combine combine: $(tests_combine) %.js: FORCE - node --stack_trace_limit=20 $@ + NODE_PATH=".:$(NODE_PATH)" node --stack_trace_limit=20 "$@" test-%: FORCE ./$@ diff --git a/test/MemberBuilder-MethodTest.js b/test/MemberBuilder/MethodTest.js similarity index 98% rename from test/MemberBuilder-MethodTest.js rename to test/MemberBuilder/MethodTest.js index 73f5117..68c44dc 100644 --- a/test/MemberBuilder-MethodTest.js +++ b/test/MemberBuilder/MethodTest.js @@ -22,9 +22,9 @@ * @package test */ -var common = require( './common' ), +var common = require( 'common' ), assert = require( 'assert' ), - mb_common = require( __dirname + '/inc-member_builder-common' ), + mb_common = require( __dirname + '/../inc-member_builder-common' ), util = common.require( 'util' ), // stub factories used for testing diff --git a/tools/combine b/tools/combine index 429cc86..af2be8a 100755 --- a/tools/combine +++ b/tools/combine @@ -132,11 +132,11 @@ done # include tests? if [ "$INC_TEST" ]; then # note that not all tests are included - TEST_CASES=$( find $PATH_TEST \ + TEST_CASES=$( cd "$PATH_TEST"; find . \ \( -name 'test-*.js' \ -o -name '*Test*.js' \ \) \ - -exec basename {} \; \ + | sed 's/^.\///' \ | sort \ | grep -v 'test-\(combine\(-pre-es5\)\?\|index\).js' \ ) @@ -157,7 +157,7 @@ if [ "$INC_TEST" ]; then # generate the module name by removing path and extension, then # prefixing it with "test/" module="${filename%.*}" - module="test/${module##*/}" + module="test/${module##*test/}" # each module must be enclosed in a closure to emulate a module echo "/** TEST CASE: $testcase **/" diff --git a/tools/combine.tpl b/tools/combine.tpl index d978cba..e4c1625 100644 --- a/tools/combine.tpl +++ b/tools/combine.tpl @@ -41,8 +41,9 @@ var easejs = {}; var require = function( module_id ) { // remove the './' directory prefix (every module is currently included - // via a relative path) - var id_clean = module_id.replace( /^\.?\//, '' ); + // via a relative path) and stupidly remove single ../'s (combine script + // doesn't include true paths, so they're not necessary to resolve) + var id_clean = module_id.replace( /^\.?\/|\.\.\//, '' ); // attempt to retrieve the module var mod = module[ id_clean ];