Browse Source

Change IronPython and IronRuby Run without Debugger menu option to pause the console output after the run is complete.

pull/1/head
mrward 15 years ago
parent
commit
ee134f91a4
  1. 3
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunPythonCommand.cs
  2. 8
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/RunPythonCommandTests.cs
  3. 2
      src/AddIns/BackendBindings/Ruby/RubyBinding.sln
  4. 6
      src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RunRubyCommand.cs
  5. 25
      src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/DebugRunRubyCommandTests.cs
  6. 33
      src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/RunRubyCommandTests.cs
  7. 2
      src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj
  8. 1
      src/AddIns/BackendBindings/Scripting/Project/ICSharpCode.Scripting.csproj
  9. 35
      src/AddIns/BackendBindings/Scripting/Project/Src/PauseCommandPromptProcessStartInfo.cs

3
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunPythonCommand.cs

@ -48,7 +48,8 @@ namespace ICSharpCode.PythonBinding @@ -48,7 +48,8 @@ namespace ICSharpCode.PythonBinding
if (Debug) {
debugger.Start(processStartInfo);
} else {
debugger.StartWithoutDebugging(processStartInfo);
PauseCommandPromptProcessStartInfo pauseCommandPrompt = new PauseCommandPromptProcessStartInfo(processStartInfo);
debugger.StartWithoutDebugging(pauseCommandPrompt.ProcessStartInfo);
}
}

8
src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/RunPythonCommandTests.cs

@ -50,18 +50,18 @@ namespace PythonBinding.Tests.Gui @@ -50,18 +50,18 @@ namespace PythonBinding.Tests.Gui
}
[Test]
public void Run_PythonFileOpen_IronPythonConsoleFileNamePassedToDebugger()
public void Run_PythonFileOpen_CommandPromptExePassedToDebugger()
{
string fileName = debugger.ProcessStartInfo.FileName;
string expectedFileName = @"C:\IronPython\ipy.exe";
string expectedFileName = "cmd.exe";
Assert.AreEqual(expectedFileName, fileName);
}
[Test]
public void Run_PythonFileOpen_PythonFileNamePassedToIronPythonConsole()
public void Run_PythonFileOpen_IronPythonConsoleAndPythonFileNameAndPausePassedAsCommandLineArguments()
{
string args = debugger.ProcessStartInfo.Arguments;
string expectedArgs = "\"C:\\Projects\\test.py\"";
string expectedArgs = "/c \"C:\\IronPython\\ipy.exe \"C:\\Projects\\test.py\"\" & pause";
Assert.AreEqual(expectedArgs, args);
}

2
src/AddIns/BackendBindings/Ruby/RubyBinding.sln

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 4.0.0.6511
# SharpDevelop 4.0.0.6676
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RubyBinding", "RubyBinding\Project\RubyBinding.csproj", "{C896FFFF-5B6C-4B0E-B6DF-049865F501B4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RubyBinding.Tests", "RubyBinding\Test\RubyBinding.Tests.csproj", "{01DF0475-0CB2-4E81-971B-BADC60CDE3A5}"

6
src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RunRubyCommand.cs

@ -43,10 +43,12 @@ namespace ICSharpCode.RubyBinding @@ -43,10 +43,12 @@ namespace ICSharpCode.RubyBinding
public override void Run()
{
ProcessStartInfo processStartInfo = CreateProcessStartInfo();
if (debug) {
debugger.Start(CreateProcessStartInfo());
debugger.Start(processStartInfo);
} else {
debugger.StartWithoutDebugging(CreateProcessStartInfo());
PauseCommandPromptProcessStartInfo commandPrompt = new PauseCommandPromptProcessStartInfo(processStartInfo);
debugger.StartWithoutDebugging(commandPrompt.ProcessStartInfo);
}
}

25
src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/DebugRunRubyCommandTestFixture.cs → src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/DebugRunRubyCommandTests.cs

@ -13,13 +13,13 @@ using RubyBinding.Tests.Utils; @@ -13,13 +13,13 @@ using RubyBinding.Tests.Utils;
namespace RubyBinding.Tests.Gui
{
[TestFixture]
public class DebugRubyCommandTestFixture
public class DebugRubyCommandTests
{
MockDebugger debugger;
RunDebugRubyCommand command;
[TestFixtureSetUp]
public void SetUpFixture()
[SetUp]
public void Init()
{
MockWorkbench workbench = MockWorkbench.CreateWorkbenchWithOneViewContent(@"C:\Projects\test.rb");
@ -33,21 +33,28 @@ namespace RubyBinding.Tests.Gui @@ -33,21 +33,28 @@ namespace RubyBinding.Tests.Gui
}
[Test]
public void DebuggerStartMethodCalled()
public void Run_RubyFileOpen_DebuggerStartMethodCalled()
{
Assert.IsTrue(debugger.StartMethodCalled);
bool startMethodCalled = debugger.StartMethodCalled;
Assert.IsTrue(startMethodCalled);
}
[Test]
public void ProcessInfoFileNameContainsPathToIronRubyConsole()
public void Run_RubyFileOpen_ProcessInfoFileNameContainsPathToIronRubyConsole()
{
Assert.AreEqual(@"C:\IronRuby\ir.exe", debugger.ProcessStartInfo.FileName);
string fileName = debugger.ProcessStartInfo.FileName;
string expectedFileName = @"C:\IronRuby\ir.exe";
Assert.AreEqual(expectedFileName, fileName);
}
[Test]
public void ProcessInfoArgsHasDebugArgument()
public void Run_RubyFileOpen_ProcessInfoArgsHasDebugArgument()
{
Assert.AreEqual("-D test.rb", debugger.ProcessStartInfo.Arguments);
string arguments = debugger.ProcessStartInfo.Arguments;
string expectedArguments = "-D test.rb";
Assert.AreEqual(expectedArguments, arguments);
}
}
}

33
src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/RunRubyCommandTests.cs

@ -22,8 +22,8 @@ namespace RubyBinding.Tests.Gui @@ -22,8 +22,8 @@ namespace RubyBinding.Tests.Gui
MockDebugger debugger;
RunRubyCommand command;
[TestFixtureSetUp]
public void SetUpFixture()
[SetUp]
public void Init()
{
MockWorkbench workbench = MockWorkbench.CreateWorkbenchWithOneViewContent(@"C:\Projects\test.rb");
@ -37,33 +37,42 @@ namespace RubyBinding.Tests.Gui @@ -37,33 +37,42 @@ namespace RubyBinding.Tests.Gui
}
[Test]
public void RunRubyCommandIsAbstractCommand()
public void Run_RubyFileOpen_RubyCommandIsAbstractCommand()
{
Assert.IsNotNull(command as AbstractCommand);
AbstractCommand abstractCommand = command as AbstractCommand;
Assert.IsNotNull(abstractCommand);
}
[Test]
public void DebuggerStartWithoutDebuggingMethodCalled()
public void Run_RubyFileOpen_DebuggerStartWithoutDebuggingMethodCalled()
{
Assert.IsTrue(debugger.StartWithoutDebuggingMethodCalled);
bool startCalled = debugger.StartWithoutDebuggingMethodCalled;
Assert.IsTrue(startCalled);
}
[Test]
public void ProcessInfoFileNameIsIronRubyConsole()
public void Run_RubyFileOpen_ProcessInfoFileNameIsIronRubyConsole()
{
Assert.AreEqual(@"C:\IronRuby\ir.exe", debugger.ProcessStartInfo.FileName);
string fileName = debugger.ProcessStartInfo.FileName;
string expectedFileName = "cmd.exe";
Assert.AreEqual(expectedFileName, fileName);
}
[Test]
public void ProcessInfoArgsContainsFileNameActiveInTextEditor()
public void Run_RubyFileOpen_ProcessInfoArgsContainsFileNameActiveInTextEditor()
{
Assert.AreEqual("test.rb", debugger.ProcessStartInfo.Arguments);
string arguments = debugger.ProcessStartInfo.Arguments;
string expectedArguments = "/c \"C:\\IronRuby\\ir.exe test.rb\" & pause";
Assert.AreEqual(expectedArguments, arguments);
}
[Test]
public void WorkingDirectoryIsSameDirectoryAsFileBeingRun()
public void Run_RubyFileOpen_WorkingDirectoryIsSameDirectoryAsFileBeingRun()
{
Assert.AreEqual(@"C:\Projects", debugger.ProcessStartInfo.WorkingDirectory);
string directory = debugger.ProcessStartInfo.WorkingDirectory;
string expectedDirectory = @"C:\Projects";
Assert.AreEqual(expectedDirectory, directory);
}
}
}

2
src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj

@ -266,7 +266,7 @@ @@ -266,7 +266,7 @@
<Compile Include="Designer\RubyPropertyAssignmentToStringTests.cs" />
<Compile Include="Designer\TextBoxNotAddedToFormTestFixture.cs" />
<Compile Include="Designer\UnknownTypeTestFixture.cs" />
<Compile Include="Gui\DebugRunRubyCommandTestFixture.cs" />
<Compile Include="Gui\DebugRunRubyCommandTests.cs" />
<Compile Include="Gui\RubyIndentationTests.cs" />
<Compile Include="Gui\RubyOptionsPanelTestFixture.cs" />
<Compile Include="Gui\RunRubyCommandTests.cs" />

1
src/AddIns/BackendBindings/Scripting/Project/ICSharpCode.Scripting.csproj

@ -80,6 +80,7 @@ @@ -80,6 +80,7 @@
<Compile Include="Src\IScriptingDesignerGenerator.cs" />
<Compile Include="Src\IScriptingFileService.cs" />
<Compile Include="Src\IScriptingWorkbench.cs" />
<Compile Include="Src\PauseCommandPromptProcessStartInfo.cs" />
<Compile Include="Src\ScriptingCodeBuilder.cs" />
<Compile Include="Src\ScriptingConsole.cs" />
<Compile Include="Src\ScriptingConsoleCompletionData.cs" />

35
src/AddIns/BackendBindings/Scripting/Project/Src/PauseCommandPromptProcessStartInfo.cs

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Diagnostics;
namespace ICSharpCode.Scripting
{
public class PauseCommandPromptProcessStartInfo
{
ProcessStartInfo processStartInfo;
public PauseCommandPromptProcessStartInfo(ProcessStartInfo processStartInfo)
{
this.processStartInfo = processStartInfo;
ChangeProcessStartInfoToPauseCommandPrompt();
}
public ProcessStartInfo ProcessStartInfo {
get { return processStartInfo; }
}
void ChangeProcessStartInfoToPauseCommandPrompt()
{
processStartInfo.Arguments = GetArguments();
processStartInfo.FileName = "cmd.exe";
}
string GetArguments()
{
return String.Format("/c \"{0} {1}\" & pause",
processStartInfo.FileName, processStartInfo.Arguments);
}
}
}
Loading…
Cancel
Save