anchor.diff:  	<cfinclude template="plugins/injection.cfm">
   
   	<cfset variables.WHEELS_TESTS_BASE_COMPONENT_PATH = "">
  -	<cfset variables.WHEELS_TESTS_BASE_ROOT_PATH = "">
   
   	<!---
   		Instanciate all components in specified package and call their runTest()
  
positive.code: 			and teardown() if provided.
  		--->
  		<cfset keyList = listSort(structKeyList(this), "textnocase", "asc")>
  		
  		<cfif structKeyExists(this, "_setup")>
  			<cfset _setup()>
  		</cfif>
  
negative.code: 		<cfargument name="options" type="struct" required="false" default="#structnew()#">
  		<cfset var loc = {}>
  		<cfset var q = "">
  
  		<!--- the key in the request scope that will contain the test results --->
  		<cfset loc.resultKey = "WheelsTests">
  
  		<!--- struct to save the original environment when overloaded --->
  		<cfset loc.savedenv = {}>
  
  		<!--- by default we run all tests, however they can specify to run a specific oset of tests --->
  		<cfset loc.package = "">
  
  		<!--- default test type --->
  		<cfset loc.type = "core">
  
  		<!--- if they specified a package we should only run that --->
  		<cfif structkeyexists(arguments.options, "package")>
  			<cfset loc.package = arguments.options.package>
  		</cfif>
  
  		<!--- overwrite the default test type if passed --->
  		<cfif structkeyexists(arguments.options, "type")>
  			<cfset loc.type = arguments.options.type>
  		</cfif>
  
  		<!--- which tests to run --->
  		<cfif loc.type eq "core">
  			<!--- core tests --->
  			<cfset loc.root_test_path = application.wheels.wheelsComponentPath>
  		<cfelseif loc.type eq "app">
  			<!--- app tests --->
  			<cfset loc.root_test_path = application.wheels.rootComponentPath>
  		<cfelse>
  			<!--- specific plugin tests --->
  			<cfset loc.root_test_path = "#application.wheels.rootComponentPath#.#application.wheels.pluginComponentPath#.#loc.type#">
  		</cfif>
  
  		<cfset loc.root_test_path = loc.root_test_path & ".tests">
  
  		<!--- add the package if specified --->
  		<cfset loc.test_path = listappend("#loc.root_test_path#", loc.package, ".")>
  
  		<!--- clean up testpath --->
  		<cfset loc.test_path = listchangedelims(loc.test_path, ".", ".")>
  
  		<!--- convert to regular path --->
  		<cfset loc.relative_root_test_path = "/" & listchangedelims(loc.root_test_path, "/", ".")>
  		<cfset loc.full_root_test_path = expandpath(loc.relative_root_test_path)>
  		<cfset loc.releative_test_path = "/" & listchangedelims(loc.test_path, "/", ".")>
  		<cfset loc.full_test_path = expandPath(loc.releative_test_path)>
  
  		<!---
  		if env.cfm files exists, call to override enviroment settings so tests can run.
  		when overriding, save the original env so we can put it back later.
  		 --->
  		<cfif FileExists(loc.full_test_path & "/env.cfm")>
  			<cfset loc.savedenv = duplicate(application)>
  			<cfinclude template="#loc.releative_test_path & '/env.cfm'#">
  		<cfelseif FileExists(loc.full_root_test_path & "/env.cfm")>
  			<cfset loc.savedenv = duplicate(application)>
  			<cfinclude template="#loc.relative_root_test_path & '/env.cfm'#">
  		</cfif>
  
  		<!--- for test results display --->
  		<cfset variables.WHEELS_TESTS_BASE_COMPONENT_PATH = loc.test_path>
  
  		<cfdirectory directory="#loc.full_test_path#" action="list" recurse="true" name="q" filter="*.cfc" />
  
  		<!--- run tests --->
  		<cfloop query="q">
  			<cfset loc.testname = listchangedelims(removechars(directory, 1, len(loc.full_test_path)), ".", "\/")>
  			<cfset loc.testname = listprepend(loc.testname, loc.test_path, ".")>
  			<cfset loc.testname = listappend(loc.testname, listfirst(name, "."), ".")>
  			<cfif isValidTest(loc.testname)>
  				<cfset loc.instance = createObject("component", loc.testname)>
  				<cfset loc.instance.runTest(loc.resultKey)>
  			</cfif>
  		</cfloop>
  
  		<!--- swap back the enviroment if overwritten --->
  		<cfif not structisempty(loc.savedenv)>
  			<cfset application = duplicate(loc.savedenv)>
  		</cfif>
  
  		<cfreturn HTMLFormatTestResults(loc.resultKey)>
  
  	</cffunction>
  
  