@ -11,6 +11,7 @@ using System.IO;
using System.Text ;
using System.Text ;
using ICSharpCode.Core ;
using ICSharpCode.Core ;
using ICSharpCode.SharpDevelop.Dom ;
using ICSharpCode.SharpDevelop.Dom ;
using ICSharpCode.SharpDevelop.Project ;
using ICSharpCode.UnitTesting ;
using ICSharpCode.UnitTesting ;
namespace ICSharpCode.RubyBinding
namespace ICSharpCode.RubyBinding
@ -69,13 +70,19 @@ namespace ICSharpCode.RubyBinding
public ProcessStartInfo CreateProcessStartInfo ( SelectedTests selectedTests )
public ProcessStartInfo CreateProcessStartInfo ( SelectedTests selectedTests )
{
{
consoleApplication . RubyScriptFileName = GetSharpDevelopTestRubyScriptFileName ( ) ;
consoleApplication . RubyScriptFileName = GetSharpDevelopTestRubyScriptFileName ( ) ;
AddLoadPaths ( ) ;
AddLoadPaths ( selectedTests . Project ) ;
consoleApplication . RubyScriptCommandLineArguments = GetCommandLineArguments ( selectedTests ) ;
consoleApplication . RubyScriptCommandLineArguments = GetCommandLineArguments ( selectedTests ) ;
consoleApplication . WorkingDirectory = selectedTests . Project . Directory ;
consoleApplication . WorkingDirectory = selectedTests . Project . Directory ;
return consoleApplication . GetProcessStartInfo ( ) ;
return consoleApplication . GetProcessStartInfo ( ) ;
}
}
void AddLoadPaths ( )
void AddLoadPaths ( IProject project )
{
AddLoadPathForRubyStandardLibrary ( ) ;
AddLoadPathForReferencedProjects ( project ) ;
}
void AddLoadPathForRubyStandardLibrary ( )
{
{
if ( options . HasRubyLibraryPath ) {
if ( options . HasRubyLibraryPath ) {
consoleApplication . AddLoadPath ( options . RubyLibraryPath ) ;
consoleApplication . AddLoadPath ( options . RubyLibraryPath ) ;
@ -84,6 +91,17 @@ namespace ICSharpCode.RubyBinding
consoleApplication . AddLoadPath ( testRunnerLoadPath ) ;
consoleApplication . AddLoadPath ( testRunnerLoadPath ) ;
}
}
void AddLoadPathForReferencedProjects ( IProject project )
{
foreach ( ProjectItem item in project . Items ) {
ProjectReferenceProjectItem projectRef = item as ProjectReferenceProjectItem ;
if ( projectRef ! = null ) {
string directory = Path . GetDirectoryName ( projectRef . FileName ) ;
consoleApplication . AddLoadPath ( directory ) ;
}
}
}
string GetSharpDevelopTestRubyScriptFileName ( )
string GetSharpDevelopTestRubyScriptFileName ( )
{
{
string fileName = StringParser . Parse ( @"${addinpath:ICSharpCode.RubyBinding}\TestRunner\sdtest.rb" ) ;
string fileName = StringParser . Parse ( @"${addinpath:ICSharpCode.RubyBinding}\TestRunner\sdtest.rb" ) ;