Browse Source

Added support for integrated unit testing with IronPython.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5861 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Matt Ward 15 years ago
parent
commit
d9eb7f997e
  1. 14
      src/AddIns/BackendBindings/Python/PythonBinding.sln
  2. 175
      src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin
  3. 23
      src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.csproj
  4. 14
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/PythonOptionsPanel.xfrm
  5. 30
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/AddInOptions.cs
  6. 65
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/CreateTextWriterInfo.cs
  7. 20
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/IPythonFileService.cs
  8. 41
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonAstWalker.cs
  9. 26
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsole.cs
  10. 109
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsoleApplication.cs
  11. 31
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFileService.cs
  12. 7
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.cs
  13. 77
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonStandardLibraryPath.cs
  14. 73
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestDebugger.cs
  15. 63
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestFramework.cs
  16. 66
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestResult.cs
  17. 73
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunner.cs
  18. 109
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunnerApplication.cs
  19. 122
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunnerResponseFile.cs
  20. 34
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunPythonCommand.cs
  21. 95
      src/AddIns/BackendBindings/Python/PythonBinding/Project/TestRunner/sdtest.py
  22. 106
      src/AddIns/BackendBindings/Python/PythonBinding/Project/TestRunner/sdtestrunner.py
  23. 71
      src/AddIns/BackendBindings/Python/PythonBinding/Test/AddInOptionsTestFixture.cs
  24. 52
      src/AddIns/BackendBindings/Python/PythonBinding/Test/CodeCompletionBindingFromImportCompletionTestFixture.cs
  25. 6
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/CodeCompletionBindingImportCompletionTestFixture.cs
  26. 5
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/NamespaceContentsAddedToCtrlSpaceTestFixture.cs
  27. 61
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Configuration/AddInFileTestFixture.cs
  28. 94
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Configuration/AddInOptionsTestFixture.cs
  29. 3
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForLoopConversionTestFixture.cs
  30. 5
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ProjectHasStartupObjectTestFixture.cs
  31. 3
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratorMergeFindsInitializeComponentsTestFixture.cs
  32. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonDesignerLoaderTestFixture.cs
  33. 3
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonGeneratorTestFixture.cs
  34. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/AppSettingsPanelTestFixture.cs
  35. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/CompilingOptionsPanelTestFixture.cs
  36. 6
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/DebugPythonCommandTestFixture.cs
  37. 9
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/FormsDesignerDisplayBindingTestFixture.cs
  38. 4
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/PythonIndentationTests.cs
  39. 26
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/PythonOptionsPanelTestFixture.cs
  40. 3
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/PythonSyntaxModeTestFixture.cs
  41. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/RunPythonCommandTestFixture.cs
  42. 1
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ClassWithBaseClassTestFixture.cs
  43. 59
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassNestedInsideMethodTestFixture.cs
  44. 52
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseTestClassTestFixture.cs
  45. 89
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseTestClassWithBaseClassTestFixture.cs
  46. 69
      src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj
  47. 0
      src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/CreateNewPythonProjectTestFixture.cs
  48. 0
      src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/ProjectBindingTestFixture.cs
  49. 0
      src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/PythonLanguagePropertiesTests.cs
  50. 1
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveConsoleFromSystemImportEverythingFixture.cs
  51. 1
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveConsoleWriteLineTestFixture.cs
  52. 1
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFooTextBoxFromSystemWindowsFormsImportedAsFooTestFixture.cs
  53. 5
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveLocalClassInstanceTestFixture.cs
  54. 7
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemConsoleTestFixture.cs
  55. 1
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemNamespaceWithMissingImportTestFixture.cs
  56. 1
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportTextBoxTestFixture.cs
  57. 1
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportedAsMyTextBoxTestFixture.cs
  58. 52
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/CreatePythonTestRunnerTestFixture.cs
  59. 41
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/CreateTextWriterFromCreateTextWriterInfoTestFixture.cs
  60. 57
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/CreateTextWriterInfoEqualsTestFixture.cs
  61. 95
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonConsoleApplicationTestFixture.cs
  62. 82
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonStandardLibraryPathTests.cs
  63. 156
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestDebuggerRunsSelectedTestMethodTestFixture.cs
  64. 75
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestClassTests.cs
  65. 49
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestMethodTests.cs
  66. 66
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestProjectTests.cs
  67. 90
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestResultFailureTestFixture.cs
  68. 44
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestResultStackTraceLineNumberOverflowTestFixture.cs
  69. 206
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerResponseFileTestFixture.cs
  70. 225
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerRunsSelectedTestMethodTestFixture.cs
  71. 60
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/AddInPathHelper.cs
  72. 52
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedAddInOptions.cs
  73. 6
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonDesignerLoader.cs
  74. 32
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DummyServiceManager.cs
  75. 38
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DummySynchronizeInvoke.cs
  76. 31
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockClass.cs
  77. 6
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockDesignerLoaderHost.cs
  78. 297
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockMethod.cs
  79. 58
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockPythonFileService.cs
  80. 1
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockTypeResolutionService.cs
  81. 17
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockWorkbench.cs
  82. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonBindingAddInFile.cs
  83. 50
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/AddInPathHelperTestFixture.cs
  84. 5
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/MockProjectContentTests.cs
  85. 65
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/MockPythonFileServiceTestFixture.cs
  86. 316
      src/Setup/Files.wxs
  87. 8
      src/Setup/Setup.wxs

14
src/AddIns/BackendBindings/Python/PythonBinding.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.5293
# SharpDevelop 4.0.0.5840
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PythonBinding", "PythonBinding\Project\PythonBinding.csproj", "{8D732610-8FC6-43BA-94C9-7126FD7FE361}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PythonBinding.Tests", "PythonBinding\Test\PythonBinding.Tests.csproj", "{23B517C9-1ECC-4419-A13F-0B7136D085CB}"
@ -30,6 +30,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Wi @@ -30,6 +30,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Wi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonEdit.AddIn", "..\..\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj", "{0162E499-42D0-409B-AA25-EED21F75336B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting", "..\..\Analysis\UnitTesting\UnitTesting.csproj", "{1F261725-6318-4434-A1B1-6C70CE4CD324}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting.Tests", "..\..\Analysis\UnitTesting\Test\UnitTesting.Tests.csproj", "{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -94,5 +98,13 @@ Global @@ -94,5 +98,13 @@ Global
{0162E499-42D0-409B-AA25-EED21F75336B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Release|Any CPU.Build.0 = Release|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Any CPU.Build.0 = Release|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Release|Any CPU.Build.0 = Release|Any CPU
{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
EndGlobal

175
src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<AddIn name = "Python Binding"
author = "Matt Ward"
copyright = "prj:///doc/copyright.txt"
description = "Backend binding for IronPython"
<AddIn name="Python Binding"
author="Matt Ward"
copyright="prj:///doc/copyright.txt"
description="Backend binding for IronPython"
addInManagerHidden="preinstalled">
<Manifest>
@ -12,15 +12,16 @@ @@ -12,15 +12,16 @@
<Runtime>
<Import assembly=":ICSharpCode.SharpDevelop"/>
<Import assembly="$ICSharpCode.FormsDesigner/FormsDesigner.dll"/>
<Import assembly="$ICSharpCode.UnitTesting/UnitTesting.dll"/>
<Import assembly="IronPython.Modules.dll"/>
<Import assembly="PythonBinding.dll"/>
</Runtime>
<Path name="/SharpDevelop/ViewContent/AvalonEdit/SyntaxModes">
<SyntaxMode id="Python.SyntaxMode"
extensions=".py"
name="Python"
resource="ICSharpCode.PythonBinding.Resources.Python.xshd"/>
extensions=".py"
name="Python"
resource="ICSharpCode.PythonBinding.Resources.Python.xshd"/>
</Path>
<Path name="/AddIns/DefaultTextEditor/Formatter/Python">
@ -30,19 +31,19 @@ @@ -30,19 +31,19 @@
<!-- Add the "Python" entry to the Open File Dialog -->
<Path name="/SharpDevelop/Workbench/FileFilter">
<FileFilter id="Python"
insertbefore="Resources"
insertafter="Icons"
name="${res:ICSharpCode.PythonBinding.PythonFiles} (*.py)"
extensions="*.py"/>
insertbefore="Resources"
insertafter="Icons"
name="${res:ICSharpCode.PythonBinding.PythonFiles} (*.py)"
extensions="*.py"/>
</Path>
<!-- Add the "Python" entry to the Open Project Dialog -->
<Path name = "/SharpDevelop/Workbench/Combine/FileFilter">
<Path name="/SharpDevelop/Workbench/Combine/FileFilter">
<FileFilter id="PythonProject"
insertbefore="AllFiles"
name="${res:ICSharpCode.PythonBinding.PythonProjectFiles} (*.pyproj)"
class="ICSharpCode.SharpDevelop.Project.LoadProject"
extensions="*.pyproj"/>
insertbefore="AllFiles"
name="${res:ICSharpCode.PythonBinding.PythonProjectFiles} (*.pyproj)"
class="ICSharpCode.SharpDevelop.Project.LoadProject"
extensions="*.pyproj"/>
</Path>
<!-- File templates -->
@ -54,27 +55,27 @@ @@ -54,27 +55,27 @@
<Path name="/SharpDevelop/Workbench/MainMenu">
<Condition name="ActiveContentExtension" activeextension=".py">
<MenuItem id="Python"
insertafter="Search"
insertbefore="Tools"
label="&amp;Python"
type="Menu">
insertafter="Search"
insertbefore="Tools"
label="&amp;Python"
type="Menu">
<Condition name="IsProcessRunning" isprocessrunning="False" isdebugging="False" action="Disable">
<MenuItem id="Run"
icon="Icons.16x16.RunProgramIcon"
class="ICSharpCode.PythonBinding.RunDebugPythonCommand"
label="${res:XML.MainMenu.RunMenu.Run}"
shortcut="Control|Shift|R"/>
icon="Icons.16x16.RunProgramIcon"
class="ICSharpCode.PythonBinding.RunDebugPythonCommand"
label="${res:XML.MainMenu.RunMenu.Run}"
shortcut="Control|Shift|R"/>
<MenuItem id="RunWithoutDebugger"
icon="Icons.16x16.Debug.StartWithoutDebugging"
class="ICSharpCode.PythonBinding.RunPythonCommand"
label="${res:XML.MainMenu.DebugMenu.RunWithoutDebug}"
shortcut="Control|Shift|W"/>
icon="Icons.16x16.Debug.StartWithoutDebugging"
class="ICSharpCode.PythonBinding.RunPythonCommand"
label="${res:XML.MainMenu.DebugMenu.RunWithoutDebug}"
shortcut="Control|Shift|W"/>
</Condition>
<Condition name="IsProcessRunning" isdebugging="True" action="Disable">
<MenuItem id="Stop"
icon="Icons.16x16.StopProcess"
class="ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand"
label="${res:XML.MainMenu.DebugMenu.Stop}"/>
icon="Icons.16x16.StopProcess"
class="ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand"
label="${res:XML.MainMenu.DebugMenu.Stop}"/>
</Condition>
</MenuItem>
</Condition>
@ -83,22 +84,22 @@ @@ -83,22 +84,22 @@
<!-- Python parser -->
<Path name="/Workspace/Parser">
<Parser id="Python"
supportedextensions=".py"
projectfileextension=".pyproj"
class="ICSharpCode.PythonBinding.PythonParser"/>
supportedextensions=".py"
projectfileextension=".pyproj"
class="ICSharpCode.PythonBinding.PythonParser"/>
</Path>
<!-- Register Python MSBuild project (.pyproj) -->
<Path name="/SharpDevelop/Workbench/ProjectBindings">
<ProjectBinding id="Python"
guid="{FD48973F-F585-4F70-812B-4D0503B36CE9}"
supportedextensions=".py"
projectfileextension=".pyproj"
class="ICSharpCode.PythonBinding.PythonProjectBinding" />
guid="{FD48973F-F585-4F70-812B-4D0503B36CE9}"
supportedextensions=".py"
projectfileextension=".pyproj"
class="ICSharpCode.PythonBinding.PythonProjectBinding" />
</Path>
<!-- The Python code completion binding -->
<Path name = "/AddIns/DefaultTextEditor/CodeCompletion">
<Path name="/AddIns/DefaultTextEditor/CodeCompletion">
<CodeCompletionBinding id="Python"
extensions=".py"
class="ICSharpCode.PythonBinding.PythonCodeCompletionBinding"/>
@ -115,33 +116,33 @@ @@ -115,33 +116,33 @@
<!-- Options panel -->
<Path name="/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions">
<OptionPanel id="PythonOptionsPanel"
label="Python"
class="ICSharpCode.PythonBinding.PythonOptionsPanel"/>
label="Python"
class="ICSharpCode.PythonBinding.PythonOptionsPanel"/>
</Path>
<!-- Project options panels -->
<Path path="/SharpDevelop/BackendBindings/ProjectOptions/Python">
<OptionPanel id="Application"
label="${res:Dialog.ProjectOptions.ApplicationSettings}"
class="ICSharpCode.PythonBinding.ApplicationSettingsPanel"/>
label="${res:Dialog.ProjectOptions.ApplicationSettings}"
class="ICSharpCode.PythonBinding.ApplicationSettingsPanel"/>
<OptionPanel id="BuildEvents"
label="${res:Dialog.ProjectOptions.BuildEvents}"
class="ICSharpCode.SharpDevelop.Gui.OptionPanels.BuildEvents"/>
label="${res:Dialog.ProjectOptions.BuildEvents}"
class="ICSharpCode.SharpDevelop.Gui.OptionPanels.BuildEvents"/>
<OptionPanel id="CompilingOptions"
label="${res:Dialog.ProjectOptions.BuildOptions}"
class="ICSharpCode.PythonBinding.CompilingOptionsPanel"/>
label="${res:Dialog.ProjectOptions.BuildOptions}"
class="ICSharpCode.PythonBinding.CompilingOptionsPanel"/>
<OptionPanel id="DebugOptions"
label="${res:Dialog.ProjectOptions.DebugOptions}"
class="ICSharpCode.SharpDevelop.Gui.OptionPanels.DebugOptions"/>
label="${res:Dialog.ProjectOptions.DebugOptions}"
class="ICSharpCode.SharpDevelop.Gui.OptionPanels.DebugOptions"/>
</Path>
<!-- Python display binding -->
<Path name="/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id="PythonDisplayBinding"
type="Secondary"
fileNamePattern="\.py$"
languagePattern="^Python$"
class="ICSharpCode.PythonBinding.PythonFormsDesignerDisplayBinding" />
type="Secondary"
fileNamePattern="\.py$"
languagePattern="^Python$"
class="ICSharpCode.PythonBinding.PythonFormsDesignerDisplayBinding" />
</Path>
<Path name="/SharpDevelop/Workbench/MainMenu/Tools/ConvertCode">
@ -151,43 +152,49 @@ @@ -151,43 +152,49 @@
<Condition name="ActiveContentExtension" activeextension=".vb"/>
</Or>
<MenuItem id="ConvertToPython"
insertafter="CSharp"
insertbefore="VBNet"
label="Python"
class="ICSharpCode.PythonBinding.ConvertToPythonMenuCommand"/>
insertafter="CSharp"
insertbefore="VBNet"
label="Python"
class="ICSharpCode.PythonBinding.ConvertToPythonMenuCommand"/>
</ComplexCondition>
</Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions/Convert">
<Condition name = "ProjectActive" activeproject="C#">
<MenuItem id = "CSharpProjectToPythonProjectConverter"
label = "${res:ICSharpCode.PythonBinding.ConvertCSharpProjectToPythonProject}"
class = "ICSharpCode.PythonBinding.ConvertProjectToPythonProjectCommand"/>
<Path name="/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions/Convert">
<Condition name="ProjectActive" activeproject="C#">
<MenuItem id="CSharpProjectToPythonProjectConverter"
label="${res:ICSharpCode.PythonBinding.ConvertCSharpProjectToPythonProject}"
class="ICSharpCode.PythonBinding.ConvertProjectToPythonProjectCommand"/>
</Condition>
<Condition name = "ProjectActive" activeproject="VBNet">
<MenuItem id = "VBNetProjectToPythonProjectConverter"
label = "${res:ICSharpCode.PythonBinding.ConvertVBNetProjectToPythonProject}"
class = "ICSharpCode.PythonBinding.ConvertProjectToPythonProjectCommand"/>
<Condition name="ProjectActive" activeproject="VBNet">
<MenuItem id="VBNetProjectToPythonProjectConverter"
label="${res:ICSharpCode.PythonBinding.ConvertVBNetProjectToPythonProject}"
class="ICSharpCode.PythonBinding.ConvertProjectToPythonProjectCommand"/>
</Condition>
</Path>
<Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "PythonConsole"
category = "Tools"
title = "${res:ICSharpCode.PythonBinding.PythonConsole}"
insertafter = "Bookmarks"
insertbefore = "DefinitionView"
icon = "PadIcons.Output"
defaultPosition = "Bottom, Hidden"
class = "ICSharpCode.PythonBinding.PythonConsolePad"/>
</Path>
<Path name = "/Workspace/Icons">
<Icon id = "PythonFileIcon"
extensions = ".py"
resource = "Python.ProjectBrowser.File" />
<Icon id = "PythonProjectIcon"
language = "Python"
resource = "Python.ProjectBrowser.Project" />
<Path name="/SharpDevelop/Workbench/Pads">
<Pad id="PythonConsole"
category="Tools"
title="${res:ICSharpCode.PythonBinding.PythonConsole}"
insertafter="Bookmarks"
insertbefore="DefinitionView"
icon="PadIcons.Output"
defaultPosition="Bottom, Hidden"
class="ICSharpCode.PythonBinding.PythonConsolePad"/>
</Path>
<Path name="/Workspace/Icons">
<Icon id="PythonFileIcon"
extensions=".py"
resource="Python.ProjectBrowser.File" />
<Icon id="PythonProjectIcon"
language="Python"
resource="Python.ProjectBrowser.Project" />
</Path>
<Path name="/SharpDevelop/UnitTesting/TestFrameworks">
<TestFramework id="pyunit"
class="ICSharpCode.PythonBinding.PythonTestFramework"
supportedProjects=".pyproj" />
</Path>
</AddIn>

23
src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.csproj

@ -74,11 +74,15 @@ @@ -74,11 +74,15 @@
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\AddInOptions.cs" />
<Compile Include="Src\CompilingOptionsPanel.cs" />
<Compile Include="Src\CreateTextWriterInfo.cs" />
<Compile Include="Src\IPythonFileService.cs" />
<Compile Include="Src\IPythonResolver.cs" />
<Compile Include="Src\MemberName.cs" />
<Compile Include="Src\PythonBuiltInModuleMemberName.cs" />
<Compile Include="Src\PythonClassResolver.cs" />
<Compile Include="Src\PythonConsoleApplication.cs" />
<Compile Include="Src\PythonDotNetMethodResolver.cs" />
<Compile Include="Src\PythonFileService.cs" />
<Compile Include="Src\PythonFromImport.cs" />
<Compile Include="Src\PythonImport.cs" />
<Compile Include="Src\PythonMethodGroupResolveResult.cs" />
@ -89,11 +93,18 @@ @@ -89,11 +93,18 @@
<Compile Include="Src\PythonNameCreationService.cs" />
<Compile Include="Src\PythonNamespaceResolver.cs" />
<Compile Include="Src\PythonResolverContext.cs" />
<Compile Include="Src\PythonStandardLibraryPath.cs" />
<Compile Include="Src\PythonStandardModuleMethodResolver.cs" />
<Compile Include="Src\PythonStandardModuleMethodResolveResult.cs" />
<Compile Include="Src\PythonStandardModuleResolver.cs" />
<Compile Include="Src\PythonStandardModuleResolveResult.cs" />
<Compile Include="Src\PythonStandardModuleType.cs" />
<Compile Include="Src\PythonTestDebugger.cs" />
<Compile Include="Src\PythonTestFramework.cs" />
<Compile Include="Src\PythonTestResult.cs" />
<Compile Include="Src\PythonTestRunner.cs" />
<Compile Include="Src\PythonTestRunnerApplication.cs" />
<Compile Include="Src\PythonTestRunnerResponseFile.cs" />
<Compile Include="Src\SysModuleCompletionItems.cs" />
<Compile Include="Src\IComponentCreator.cs" />
<Compile Include="Src\IMemberProvider.cs" />
@ -178,9 +189,16 @@ @@ -178,9 +189,16 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<EmbeddedResource Include="Resources\Python.xshd" />
<None Include="TestRunner\sdtest.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="TestRunner\sdtestrunner.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Lib" />
<Folder Include="TestRunner" />
<Folder Include="Templates" />
<Folder Include="Resources" />
<ProjectReference Include="..\..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">
@ -208,6 +226,11 @@ @@ -208,6 +226,11 @@
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Analysis\UnitTesting\UnitTesting.csproj">
<Project>{1F261725-6318-4434-A1B1-6C70CE4CD324}</Project>
<Name>UnitTesting</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj">
<Project>{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}</Project>
<Name>FormsDesigner</Name>

14
src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/PythonOptionsPanel.xfrm

@ -11,6 +11,20 @@ @@ -11,6 +11,20 @@
<Size value="320, 229" />
<TabIndex value="0" />
<Controls>
<System.Windows.Forms.TextBox>
<Name value="pythonLibraryPathTextBox" />
<TabIndex value="4" />
<Location value="95, 52" />
<Anchor value="Top, Left, Right" />
<Size value="217, 20" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="pythonLibraryPathLabel" />
<Location value="6, 54" />
<Text value="Path:" />
<Size value="83, 23" />
<TabIndex value="3" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="browseButton" />
<Location value="288, 25" />

30
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/AddInOptions.cs

@ -29,6 +29,7 @@ namespace ICSharpCode.PythonBinding @@ -29,6 +29,7 @@ namespace ICSharpCode.PythonBinding
#region Property names
public static readonly string PythonFileNameProperty = "PythonFileName";
public static readonly string PythonLibraryPathProperty = "PythonLibraryPath";
#endregion
Properties properties;
@ -47,13 +48,20 @@ namespace ICSharpCode.PythonBinding @@ -47,13 +48,20 @@ namespace ICSharpCode.PythonBinding
this.properties = properties;
}
public string PythonLibraryPath {
get { return properties.Get<string>(PythonLibraryPathProperty, String.Empty); }
set { properties.Set(PythonLibraryPathProperty, value); }
}
public bool HasPythonLibraryPath {
get { return !String.IsNullOrEmpty(PythonLibraryPath); }
}
/// <summary>
/// Gets or sets the python console filename.
/// </summary>
public string PythonFileName {
get {
return properties.Get<string>(PythonFileNameProperty, GetDefaultPythonFileName());
}
get { return properties.Get<string>(PythonFileNameProperty, GetDefaultPythonFileName()); }
set {
if (String.IsNullOrEmpty(value)) {
properties.Set(PythonFileNameProperty, GetDefaultPythonFileName());
@ -63,23 +71,19 @@ namespace ICSharpCode.PythonBinding @@ -63,23 +71,19 @@ namespace ICSharpCode.PythonBinding
}
}
/// <summary>
/// Gets the path to the specified addin.
/// </summary>
/// <param name="addIn">The addin name: "${addin:ICSharpCode.PythonBinding}"</param>
protected virtual string GetAddInPath(string addIn)
{
return StringParser.Parse(addIn);
}
/// <summary>
/// Returns the full path to ipyw.exe which is installed in the
/// Python addin folder.
/// </summary>
string GetDefaultPythonFileName()
{
string path = GetAddInPath("${addinpath:ICSharpCode.PythonBinding}");
string path = GetPythonBindingAddInPath();
return Path.Combine(path, DefaultPythonFileName);
}
string GetPythonBindingAddInPath()
{
return StringParser.Parse("${addinpath:ICSharpCode.PythonBinding}");
}
}
}

65
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/CreateTextWriterInfo.cs

@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Text;
namespace ICSharpCode.PythonBinding
{
public class CreateTextWriterInfo
{
string fileName;
Encoding encoding;
bool append;
public CreateTextWriterInfo(string fileName, Encoding encoding, bool append)
{
this.fileName = fileName;
this.encoding = encoding;
this.append = append;
}
public string FileName {
get { return fileName; }
}
public Encoding Encoding {
get { return encoding; }
}
public bool Append {
get { return append; }
}
public override bool Equals(object obj)
{
CreateTextWriterInfo rhs = obj as CreateTextWriterInfo;
if (rhs != null) {
return Equals(rhs);
}
return false;
}
bool Equals(CreateTextWriterInfo rhs)
{
return (fileName == rhs.fileName) &&
(encoding == rhs.encoding) &&
(append == rhs.append);
}
public override int GetHashCode()
{
return base.GetHashCode();
}
public TextWriter CreateTextWriter()
{
return new StreamWriter(fileName, append, encoding);
}
}
}

20
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/IPythonFileService.cs

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Text;
namespace ICSharpCode.PythonBinding
{
public interface IPythonFileService
{
string GetTempFileName();
TextWriter CreateTextWriter(CreateTextWriterInfo createTextWriterInfo);
void DeleteFile(string fileName);
}
}

41
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonAstWalker.cs

@ -23,18 +23,30 @@ namespace ICSharpCode.PythonBinding @@ -23,18 +23,30 @@ namespace ICSharpCode.PythonBinding
public class PythonAstWalker : PythonWalker
{
DefaultCompilationUnit compilationUnit;
DefaultClass currentClass;
DefaultClass globalClass;
string currentNamespace;
IClass currentClass;
IClass globalClass;
/// <summary>
/// All classes in a file take the namespace of the filename.
/// </summary>
public PythonAstWalker(IProjectContent projectContent, string fileName)
{
CreateCompilationUnit(projectContent, fileName);
}
void CreateCompilationUnit(IProjectContent projectContent, string fileName)
{
compilationUnit = new DefaultCompilationUnit(projectContent);
compilationUnit.FileName = fileName;
currentNamespace = Path.GetFileNameWithoutExtension(fileName);
CreateUsingScopeForCompilationUnit(fileName);
}
void CreateUsingScopeForCompilationUnit(string fileName)
{
DefaultUsingScope usingScope = new DefaultUsingScope();
usingScope.NamespaceName = Path.GetFileNameWithoutExtension(fileName);
compilationUnit.UsingScope = usingScope;
}
/// <summary>
@ -62,7 +74,7 @@ namespace ICSharpCode.PythonBinding @@ -62,7 +74,7 @@ namespace ICSharpCode.PythonBinding
c.Region = GetRegion(node);
c.BodyRegion = GetBodyRegion(node.Body, node.Header);
AddBaseTypes(c, node.Bases);
// Save the class.
compilationUnit.Classes.Add(c);
@ -80,7 +92,7 @@ namespace ICSharpCode.PythonBinding @@ -80,7 +92,7 @@ namespace ICSharpCode.PythonBinding
public override bool Walk(FunctionDefinition node)
{
if (node.Body == null) {
return true;
return false;
}
bool ignoreFirstMethodParameter = true;
@ -91,7 +103,7 @@ namespace ICSharpCode.PythonBinding @@ -91,7 +103,7 @@ namespace ICSharpCode.PythonBinding
c = globalClass;
ignoreFirstMethodParameter = false;
}
// Create method.
string methodName = node.Name;
DomRegion bodyRegion = GetBodyRegion(node.Body, node.Header);
@ -107,7 +119,7 @@ namespace ICSharpCode.PythonBinding @@ -107,7 +119,7 @@ namespace ICSharpCode.PythonBinding
method.Parameters.Add(parameter);
}
c.Methods.Add(method);
return true;
return false;
}
/// <summary>
@ -120,7 +132,7 @@ namespace ICSharpCode.PythonBinding @@ -120,7 +132,7 @@ namespace ICSharpCode.PythonBinding
compilationUnit.UsingScope.Usings.Add(import);
return false;
}
public override bool Walk(FromImportStatement node)
{
PythonFromImport import = new PythonFromImport(compilationUnit.ProjectContent, node);
@ -185,7 +197,12 @@ namespace ICSharpCode.PythonBinding @@ -185,7 +197,12 @@ namespace ICSharpCode.PythonBinding
/// </summary>
void AddBaseType(IClass c, string name)
{
c.BaseTypes.Add(new SearchClassReturnType(c.ProjectContent, c, 0, 0, name, 0));
c.BaseTypes.Add(CreateSearchClassReturnType(c, name));
}
SearchClassReturnType CreateSearchClassReturnType(IClass c, string name)
{
return new SearchClassReturnType(c.ProjectContent, c, 0, 0, name, 0);
}
/// <summary>
@ -215,7 +232,7 @@ namespace ICSharpCode.PythonBinding @@ -215,7 +232,7 @@ namespace ICSharpCode.PythonBinding
/// </summary>
string GetFullyQualifiedClassName(ClassDefinition classDef)
{
return String.Concat(currentNamespace, ".", classDef.Name);
return String.Concat(compilationUnit.UsingScope.NamespaceName, ".", classDef.Name);
}
/// <summary>
@ -224,7 +241,7 @@ namespace ICSharpCode.PythonBinding @@ -224,7 +241,7 @@ namespace ICSharpCode.PythonBinding
void CreateGlobalClass()
{
if (globalClass == null) {
globalClass = new DefaultClass(compilationUnit, currentNamespace);
globalClass = new DefaultClass(compilationUnit, compilationUnit.UsingScope.NamespaceName);
compilationUnit.Classes.Add(globalClass);
}
}

26
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsole.cs

@ -50,25 +50,15 @@ namespace ICSharpCode.PythonBinding @@ -50,25 +50,15 @@ namespace ICSharpCode.PythonBinding
//textArea.KeyEventHandler -= ProcessKeyPress;
//textArea.DoProcessDialogKey -= ProcessDialogKey;
}
public TextWriter Output {
get {
Console.WriteLine("PythonConsole.Output get");
return null;
}
set {
Console.WriteLine("PythonConsole.Output set");
}
get { return null; }
set { }
}
public TextWriter ErrorOutput {
get {
Console.WriteLine("PythonConsole.ErrorOutput get");
return null;
}
set {
Console.WriteLine("PythonConsole.ErrorOutput get");
}
get { return null; }
set { }
}
/// <summary>
@ -90,8 +80,6 @@ namespace ICSharpCode.PythonBinding @@ -90,8 +80,6 @@ namespace ICSharpCode.PythonBinding
/// </summary>
public string ReadLine(int autoIndentSize)
{
Console.WriteLine("PythonConsole.ReadLine(): autoIndentSize: " + autoIndentSize);
string indent = String.Empty;
if (autoIndentSize > 0) {
indent = String.Empty.PadLeft(autoIndentSize);
@ -100,7 +88,6 @@ namespace ICSharpCode.PythonBinding @@ -100,7 +88,6 @@ namespace ICSharpCode.PythonBinding
string line = ReadLineFromTextEditor();
if (line != null) {
Console.WriteLine("ReadLine: " + indent + line);
return indent + line;
}
return null;
@ -111,10 +98,7 @@ namespace ICSharpCode.PythonBinding @@ -111,10 +98,7 @@ namespace ICSharpCode.PythonBinding
/// </summary>
public void Write(string text, Style style)
{
Console.WriteLine("PythonConsole.Write(text, style): " + text);
textEditor.Write(text);
if (style == Style.Prompt) {
promptLength = text.Length;
textEditor.MakeCurrentContentReadOnly();

109
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsoleApplication.cs

@ -0,0 +1,109 @@ @@ -0,0 +1,109 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Diagnostics;
using System.Text;
namespace ICSharpCode.PythonBinding
{
public class PythonConsoleApplication
{
string fileName = String.Empty;
StringBuilder arguments;
bool debug;
string pythonScriptFileName = String.Empty;
string pythonScriptCommandLineArguments = String.Empty;
string workingDirectory = String.Empty;
public PythonConsoleApplication(AddInOptions options)
: this(options.PythonFileName)
{
}
public PythonConsoleApplication(string fileName)
{
this.fileName = fileName;
}
public string FileName {
get { return fileName; }
}
public bool Debug {
get { return debug; }
set { debug = value; }
}
public string PythonScriptFileName {
get { return pythonScriptFileName; }
set { pythonScriptFileName = value; }
}
public string PythonScriptCommandLineArguments {
get { return pythonScriptCommandLineArguments; }
set { pythonScriptCommandLineArguments = value; }
}
public string WorkingDirectory {
get { return workingDirectory; }
set { workingDirectory = value; }
}
public ProcessStartInfo GetProcessStartInfo()
{
ProcessStartInfo processStartInfo = new ProcessStartInfo();
processStartInfo.FileName = fileName;
processStartInfo.Arguments = GetArguments();
processStartInfo.WorkingDirectory = workingDirectory;
return processStartInfo;
}
public string GetArguments()
{
arguments = new StringBuilder();
AppendBooleanOptionIfTrue("-X:Debug", debug);
AppendQuotedStringIfNotEmpty(pythonScriptFileName);
AppendStringIfNotEmpty(pythonScriptCommandLineArguments);
return arguments.ToString().TrimEnd();
}
void AppendBooleanOptionIfTrue(string option, bool flag)
{
if (flag) {
AppendOption(option);
}
}
void AppendOption(string option)
{
arguments.Append(option + " ");
}
void AppendQuotedStringIfNotEmpty(string option)
{
if (!String.IsNullOrEmpty(option)) {
AppendQuotedString(option);
}
}
void AppendQuotedString(string option)
{
string quotedOption = String.Format("\"{0}\"", option);
AppendOption(quotedOption);
}
void AppendStringIfNotEmpty(string option)
{
if (!String.IsNullOrEmpty(option)) {
AppendOption(option);
}
}
}
}

31
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFileService.cs

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Text;
namespace ICSharpCode.PythonBinding
{
public class PythonFileService : IPythonFileService
{
public string GetTempFileName()
{
return Path.GetTempFileName();
}
public TextWriter CreateTextWriter(CreateTextWriterInfo createTextWriterInfo)
{
return createTextWriterInfo.CreateTextWriter();
}
public void DeleteFile(string fileName)
{
File.Delete(fileName);
}
}
}

7
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.cs

@ -5,11 +5,11 @@ @@ -5,11 +5,11 @@
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using System;
using System.Drawing;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.PythonBinding
@ -21,6 +21,7 @@ namespace ICSharpCode.PythonBinding @@ -21,6 +21,7 @@ namespace ICSharpCode.PythonBinding
{
AddInOptions options;
TextBox pythonFileNameTextBox;
TextBox pythonLibraryPathTextBox;
public PythonOptionsPanel() : this(new AddInOptions())
{
@ -38,12 +39,16 @@ namespace ICSharpCode.PythonBinding @@ -38,12 +39,16 @@ namespace ICSharpCode.PythonBinding
pythonFileNameTextBox = (TextBox)ControlDictionary["pythonFileNameTextBox"];
pythonFileNameTextBox.Text = options.PythonFileName;
pythonLibraryPathTextBox = (TextBox)ControlDictionary["pythonLibraryPathTextBox"];
pythonLibraryPathTextBox.Text = options.PythonLibraryPath;
ConnectBrowseButton("browseButton", "pythonFileNameTextBox", "${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe", TextBoxEditMode.EditRawProperty);
}
public override bool StorePanelContents()
{
options.PythonFileName = pythonFileNameTextBox.Text;
options.PythonLibraryPath = pythonLibraryPathTextBox.Text;
return true;
}
}

77
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonStandardLibraryPath.cs

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.IO;
using System.Security;
using Microsoft.Win32;
namespace ICSharpCode.PythonBinding
{
public class PythonStandardLibraryPath
{
List<string> directories = new List<string>();
string path = String.Empty;
public PythonStandardLibraryPath(string path)
{
Path = path;
}
public PythonStandardLibraryPath()
{
ReadPathFromRegistry();
}
void ReadPathFromRegistry()
{
try {
using (RegistryKey registryKey = GetPythonLibraryRegistryKey()) {
if (registryKey != null) {
Path = (string)registryKey.GetValue(String.Empty, String.Empty);
}
}
} catch (SecurityException) {
} catch (UnauthorizedAccessException) {
} catch (IOException) {
}
}
RegistryKey GetPythonLibraryRegistryKey()
{
return Registry.LocalMachine.OpenSubKey(@"Software\Python\PythonCore\2.6\PythonPath");
}
public string[] Directories {
get { return directories.ToArray(); }
}
public string Path {
get { return path; }
set {
path = value;
ReadDirectories();
}
}
void ReadDirectories()
{
directories.Clear();
foreach (string item in path.Split(';')) {
string directory = item.Trim();
if (!String.IsNullOrEmpty(directory)) {
directories.Add(directory);
}
}
}
public bool HasPath {
get { return directories.Count > 0; }
}
}
}

73
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestDebugger.cs

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Diagnostics;
using ICSharpCode.UnitTesting;
namespace ICSharpCode.PythonBinding
{
public class PythonTestDebugger : TestDebuggerBase
{
AddInOptions options;
IPythonFileService fileService;
PythonTestRunnerApplication testRunnerApplication;
PythonStandardLibraryPath pythonStandardLibraryPath;
public PythonTestDebugger()
: this(new UnitTestDebuggerService(),
new UnitTestMessageService(),
new TestResultsMonitor(),
new AddInOptions(),
new PythonStandardLibraryPath(),
new PythonFileService())
{
}
public PythonTestDebugger(IUnitTestDebuggerService debuggerService,
IUnitTestMessageService messageService,
ITestResultsMonitor testResultsMonitor,
AddInOptions options,
PythonStandardLibraryPath pythonStandardLibraryPath,
IPythonFileService fileService)
: base(debuggerService, messageService, testResultsMonitor)
{
this.options = options;
this.pythonStandardLibraryPath = pythonStandardLibraryPath;
this.fileService = fileService;
}
public override void Start(SelectedTests selectedTests)
{
CreateTestRunnerApplication();
testRunnerApplication.CreateResponseFile(selectedTests);
base.Start(selectedTests);
}
void CreateTestRunnerApplication()
{
testRunnerApplication = new PythonTestRunnerApplication(base.TestResultsMonitor.FileName, options, pythonStandardLibraryPath, fileService);
}
protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests)
{
testRunnerApplication.Debug = true;
return testRunnerApplication.CreateProcessStartInfo(selectedTests);
}
public override void Dispose()
{
testRunnerApplication.Dispose();
base.Dispose();
}
protected override TestResult CreateTestResultForTestFramework(TestResult testResult)
{
return new PythonTestResult(testResult);
}
}
}

63
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestFramework.cs

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.UnitTesting;
namespace ICSharpCode.PythonBinding
{
public class PythonTestFramework : ITestFramework
{
public bool IsTestMethod(IMember member)
{
if (member != null) {
return member.Name.StartsWith("test");
}
return false;
}
public bool IsTestClass(IClass c)
{
while (c != null) {
if (HasTestCaseBaseType(c)) {
return true;
}
c = c.BaseClass;
}
return false;
}
bool HasTestCaseBaseType(IClass c)
{
if (c.BaseTypes.Count > 0) {
return c.BaseTypes[0].FullyQualifiedName == "unittest.TestCase";
}
return false;
}
public bool IsTestProject(IProject project)
{
return project is PythonProject;
}
public ITestRunner CreateTestRunner()
{
return new PythonTestRunner();
}
public ITestRunner CreateTestDebugger()
{
return new PythonTestDebugger();
}
public bool IsBuildNeededBeforeTestRun {
get { return false; }
}
}
}

66
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestResult.cs

@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop.Dom;
using System.Text.RegularExpressions;
using ICSharpCode.UnitTesting;
namespace ICSharpCode.PythonBinding
{
public class PythonTestResult : TestResult
{
public PythonTestResult(TestResult testResult)
: base(testResult.Name)
{
ResultType = testResult.ResultType;
Message = testResult.Message;
StackTrace = testResult.StackTrace;
}
protected override void OnStackTraceChanged()
{
if (String.IsNullOrEmpty(StackTrace)) {
ResetStackTraceFilePosition();
} else {
GetFilePositionFromStackTrace();
}
}
void ResetStackTraceFilePosition()
{
StackTraceFilePosition = FilePosition.Empty;
}
/// <summary>
/// Stack trace:
/// Traceback (most recent call last):
/// File "d:\temp\test\PyTests\Tests\MyClassTest.py", line 19, in testRaiseException
/// raise 'abc'
/// </summary>
void GetFilePositionFromStackTrace()
{
Match match = Regex.Match(StackTrace, "\\sFile\\s\"(.*?)\",\\sline\\s(\\d+),", RegexOptions.Multiline);
if (match.Success) {
try {
SetStackTraceFilePosition(match.Groups);
} catch (OverflowException) {
// Ignore.
}
}
}
void SetStackTraceFilePosition(GroupCollection groups)
{
string fileName = groups[1].Value;
int line = Convert.ToInt32(groups[2].Value);
int column = 1;
StackTraceFilePosition = new FilePosition(fileName, line, column);
}
}
}

73
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunner.cs

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using ICSharpCode.Core;
using ICSharpCode.UnitTesting;
namespace ICSharpCode.PythonBinding
{
public class PythonTestRunner : TestProcessRunnerBase
{
AddInOptions options;
PythonStandardLibraryPath pythonStandardLibraryPath;
IPythonFileService fileService;
PythonTestRunnerApplication testRunnerApplication;
public PythonTestRunner()
: this(new UnitTestProcessRunner(),
new TestResultsMonitor(),
new AddInOptions(),
new PythonStandardLibraryPath(),
new PythonFileService())
{
}
public PythonTestRunner(IUnitTestProcessRunner processRunner,
ITestResultsMonitor testResultsMonitor,
AddInOptions options,
PythonStandardLibraryPath pythonStandardLibraryPath,
IPythonFileService fileService)
: base(processRunner, testResultsMonitor)
{
this.options = options;
this.pythonStandardLibraryPath = pythonStandardLibraryPath;
this.fileService = fileService;
}
public override void Start(SelectedTests selectedTests)
{
CreateTestRunnerApplication();
testRunnerApplication.CreateResponseFile(selectedTests);
base.Start(selectedTests);
}
void CreateTestRunnerApplication()
{
testRunnerApplication = new PythonTestRunnerApplication(base.TestResultsMonitor.FileName, options, pythonStandardLibraryPath, fileService);
}
protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests)
{
return testRunnerApplication.CreateProcessStartInfo(selectedTests);
}
public override void Dispose()
{
testRunnerApplication.Dispose();
base.Dispose();
}
protected override TestResult CreateTestResultForTestFramework(TestResult testResult)
{
return new PythonTestResult(testResult);
}
}
}

109
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunnerApplication.cs

@ -0,0 +1,109 @@ @@ -0,0 +1,109 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using ICSharpCode.Core;
using ICSharpCode.UnitTesting;
namespace ICSharpCode.PythonBinding
{
public class PythonTestRunnerApplication
{
string testResultsFileName = String.Empty;
AddInOptions options;
PythonStandardLibraryPath pythonStandardLibraryPath;
PythonTestRunnerResponseFile responseFile;
IPythonFileService fileService;
CreateTextWriterInfo textWriterInfo;
PythonConsoleApplication consoleApplication;
public PythonTestRunnerApplication(string testResultsFileName,
AddInOptions options,
PythonStandardLibraryPath pythonStandardLibraryPath,
IPythonFileService fileService)
{
this.testResultsFileName = testResultsFileName;
this.options = options;
this.pythonStandardLibraryPath = pythonStandardLibraryPath;
this.fileService = fileService;
consoleApplication = new PythonConsoleApplication(options);
}
public bool Debug {
get { return consoleApplication.Debug; }
set { consoleApplication.Debug = value; }
}
public void CreateResponseFile(SelectedTests selectedTests)
{
CreateResponseFile();
using (responseFile) {
WritePythonSystemPaths();
WriteTestsResultsFileName();
WriteTests(selectedTests);
}
}
void CreateResponseFile()
{
TextWriter writer = CreateTextWriter();
responseFile = new PythonTestRunnerResponseFile(writer);
}
TextWriter CreateTextWriter()
{
string fileName = fileService.GetTempFileName();
textWriterInfo = new CreateTextWriterInfo(fileName, Encoding.UTF8, false);
return fileService.CreateTextWriter(textWriterInfo);
}
void WritePythonSystemPaths()
{
if (options.HasPythonLibraryPath) {
responseFile.WritePath(options.PythonLibraryPath);
} else if (pythonStandardLibraryPath.HasPath) {
responseFile.WritePaths(pythonStandardLibraryPath.Directories);
}
}
void WriteTestsResultsFileName()
{
responseFile.WriteResultsFileName(testResultsFileName);
}
void WriteTests(SelectedTests selectedTests)
{
responseFile.WriteTests(selectedTests);
}
public ProcessStartInfo CreateProcessStartInfo(SelectedTests selectedTests)
{
consoleApplication.PythonScriptFileName = GetSharpDevelopTestPythonScriptFileName();
consoleApplication.PythonScriptCommandLineArguments = GetResponseFileNameCommandLineArgument();
consoleApplication.WorkingDirectory = selectedTests.Project.Directory;
return consoleApplication.GetProcessStartInfo();
}
string GetSharpDevelopTestPythonScriptFileName()
{
return StringParser.Parse(@"${addinpath:ICSharpCode.PythonBinding}\TestRunner\sdtest.py");
}
string GetResponseFileNameCommandLineArgument()
{
return String.Format("\"@{0}\"", textWriterInfo.FileName);
}
public void Dispose()
{
fileService.DeleteFile(textWriterInfo.FileName);
}
}
}

122
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunnerResponseFile.cs

@ -0,0 +1,122 @@ @@ -0,0 +1,122 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Text;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.UnitTesting;
namespace ICSharpCode.PythonBinding
{
public class PythonTestRunnerResponseFile : IDisposable
{
TextWriter writer;
public PythonTestRunnerResponseFile(string fileName)
: this(new StreamWriter(fileName, false, Encoding.UTF8))
{
}
public PythonTestRunnerResponseFile(TextWriter writer)
{
this.writer = writer;
}
public void WriteTest(string testName)
{
writer.WriteLine(testName);
}
public void WritePaths(string[] paths)
{
foreach (string path in paths) {
WritePath(path);
}
}
public void WritePathIfNotEmpty(string path)
{
if (!String.IsNullOrEmpty(path)) {
WritePath(path);
}
}
public void WritePath(string path)
{
WriteQuotedArgument("p", path);
}
void WriteQuotedArgument(string option, string value)
{
writer.WriteLine("/{0}:\"{1}\"", option, value);
}
public void WriteResultsFileName(string fileName)
{
WriteQuotedArgument("r", fileName);
}
public void Dispose()
{
writer.Dispose();
}
public void WriteTests(SelectedTests selectedTests)
{
WritePathsForReferencedProjects(selectedTests.Project);
if (selectedTests.Method != null) {
WriteTest(selectedTests.Method.FullyQualifiedName);
} else if (selectedTests.Class != null) {
WriteTest(selectedTests.Class.FullyQualifiedName);
} else if (!String.IsNullOrEmpty(selectedTests.NamespaceFilter)) {
WriteTest(selectedTests.NamespaceFilter);
} else {
WriteProjectTests(selectedTests.Project);
}
}
void WriteProjectTests(IProject project)
{
if (project != null) {
WriteProjectFileItems(project.Items);
}
}
void WritePathsForReferencedProjects(IProject project)
{
if (project != null) {
foreach (ProjectItem item in project.Items) {
ProjectReferenceProjectItem projectRef = item as ProjectReferenceProjectItem;
if (projectRef != null) {
string directory = Path.GetDirectoryName(projectRef.FileName);
WritePathIfNotEmpty(directory);
}
}
}
}
void WriteProjectFileItems(ReadOnlyCollection<ProjectItem> items)
{
foreach (ProjectItem item in items) {
FileProjectItem fileItem = item as FileProjectItem;
if (fileItem != null) {
WriteFileNameWithoutExtension(fileItem.FileName);
}
}
}
void WriteFileNameWithoutExtension(string fileName)
{
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName);
WriteTest(fileNameWithoutExtension);
}
}
}

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

@ -23,7 +23,7 @@ namespace ICSharpCode.PythonBinding @@ -23,7 +23,7 @@ namespace ICSharpCode.PythonBinding
IDebugger debugger;
AddInOptions options;
IWorkbench workbench;
bool debug;
PythonConsoleApplication ipy;
public RunPythonCommand()
: this(WorkbenchSingleton.Workbench, new AddInOptions(), DebuggerService.CurrentDebugger)
@ -35,40 +35,28 @@ namespace ICSharpCode.PythonBinding @@ -35,40 +35,28 @@ namespace ICSharpCode.PythonBinding
this.workbench = workbench;
this.debugger = debugger;
this.options = options;
ipy = new PythonConsoleApplication(options);
}
public bool Debug {
get { return debug; }
set { debug = value; }
get { return ipy.Debug; }
set { ipy.Debug = value; }
}
public override void Run()
{
if (debug) {
debugger.Start(CreateProcessStartInfo());
ProcessStartInfo processStartInfo = GetProcessStartInfo();
if (Debug) {
debugger.Start(processStartInfo);
} else {
debugger.StartWithoutDebugging(CreateProcessStartInfo());
debugger.StartWithoutDebugging(processStartInfo);
}
}
ProcessStartInfo CreateProcessStartInfo()
{
ProcessStartInfo info = new ProcessStartInfo();
info.FileName = options.PythonFileName;
info.Arguments = GetArguments();
return info;
}
string GetArguments()
ProcessStartInfo GetProcessStartInfo()
{
// Get the python script filename.
string pythonScriptFileName = "\"" + workbench.ActiveWorkbenchWindow.ActiveViewContent.PrimaryFileName + "\"";
if (Debug) {
return "-D " + pythonScriptFileName;
}
return pythonScriptFileName;
ipy.PythonScriptFileName = workbench.ActiveWorkbenchWindow.ActiveViewContent.PrimaryFileName;
return ipy.GetProcessStartInfo();
}
}
}

95
src/AddIns/BackendBindings/Python/PythonBinding/Project/TestRunner/sdtest.py

@ -0,0 +1,95 @@ @@ -0,0 +1,95 @@
import sys
import System.IO
class SharpDevelopTestProgram:
def __init__(self):
self._sysPaths = []
self._testNames = []
def run(self):
if self._validateCommandLineArgs():
self._runTests()
return
print 'Usage: sdunittest.py test-names-file sys-paths-file test-results-file'
print 'Usage: sdunittest.py @response-file'
print ''
print 'Example response file content: '
print '/p:"sys/path/1"'
print '/p:"sys/path/2"'
print '/r:"path/to/results-file"'
print 'test-name1'
print 'test-name2'
print 'test-name3'
def _validateCommandLineArgs(self):
if len(sys.argv) == 4:
self._testNamesFile = sys.argv[1]
self._sysPathFile = sys.argv[2]
self._testResultsFile = sys.argv[3]
self._responseFile = ''
return True
if len(sys.argv) == 2:
return self._getResponseFileName(sys.argv[1])
return False
def _getResponseFileName(self, fileName):
if len(fileName) > 0:
if fileName[0] == '@':
self._responseFile = fileName[1:]
return True
return False
def _runTests(self):
if len(self._responseFile) > 0:
self._readResponseFile()
else:
self._readSysPathsFromFile()
self._readTestNames()
self._addSysPaths()
import unittest
import sdtestrunner
suite = unittest.TestLoader().loadTestsFromNames(self._testNames)
sdtestrunner.SharpDevelopTestRunner(resultsFileName=self._testResultsFile, verbosity=2).run(suite)
def _readResponseFile(self):
for line in self._readLinesFromFile(self._responseFile):
self._readResponseFileArgument(line)
def _readResponseFileArgument(self, line):
if line.startswith('/r:'):
line = self._removeQuotes(line[3:])
self._testResultsFile = line
elif line.startswith('/p:'):
line = self._removeQuotes(line[3:])
self._sysPaths.append(line)
else:
self._testNames.append(line)
def _removeQuotes(self, line):
return line.strip('\"')
def _readLinesFromFile(self, fileName):
#f = codecs.open(fileName, 'rb', 'utf-8')
#return f.readall().splitlines()
return System.IO.File.ReadAllLines(fileName)
def _readTestNames(self):
self._testNames = self._readLinesFromFile(self._testNamesFile)
def _readSysPathsFromFile(self):
self._sysPaths = self._readLinesFromFile(self._sysPathFile)
def _addSysPaths(self):
for path in self._sysPaths:
sys.path.append(path)
if __name__ == '__main__':
program = SharpDevelopTestProgram()
program.run()

106
src/AddIns/BackendBindings/Python/PythonBinding/Project/TestRunner/sdtestrunner.py

@ -0,0 +1,106 @@ @@ -0,0 +1,106 @@
import codecs
import sys
import time
from unittest import TestResult
from unittest import TextTestRunner
from unittest import _TextTestResult
from unittest import _WritelnDecorator
class _SharpDevelopTestResultWriter:
def __init__(self, resultsFileName):
self.stream = codecs.open(resultsFileName, "w+", "utf-8-sig")
def _writeln(self, arg):
self.stream.write(arg)
self.stream.write('\r\n')
def _writeTestName(self, test):
self._writeln("Name: " + test.id())
def _writeTestResult(self, result):
self._writeln("Result: " + result)
def _writeTestSuccess(self):
self._writeTestResult("Success")
def _writeTestFailure(self, test, err, testResult):
self._writeTestResult("Failure")
exctype, value, tb = err
if value != None:
message = self._prefixLinesWithSpaceChar(str(value))
self._writeln("Message: " + message)
excInfoString = testResult._exc_info_to_string(err, test)
excInfoString = self._prefixLinesWithSpaceChar(excInfoString)
self._writeln("StackTrace: " + excInfoString)
def _prefixLinesWithSpaceChar(self, text):
lines = []
originalLines = text.splitlines()
if len(originalLines) == 0:
return text
lines.append(originalLines[0] + '\r\n')
for line in originalLines[1:]:
lines.append(' ' + line + '\r\n')
return ''.join(lines).rstrip()
def addSuccess(self, test):
self._writeTestName(test)
self._writeTestSuccess()
def addError(self, test, err, testResult):
self._writeTestName(test)
self._writeTestFailure(test, err, testResult)
def addFailure(self, test, err, testResult):
self._writeTestName(test)
self._writeTestFailure(test, err, testResult)
class _SharpDevelopNullTestResultWriter:
def __init__(self):
pass
def addSuccess(self, test):
pass
def addError(self, test, err, testResult):
pass
def addFailure(self, test, err, testResult):
pass
class _SharpDevelopTestResult(_TextTestResult):
def __init__(self, stream, descriptions, verbosity, resultWriter):
_TextTestResult.__init__(self, stream, descriptions, verbosity)
self.resultWriter = resultWriter
def addSuccess(self, test):
self.resultWriter.addSuccess(test)
_TextTestResult.addSuccess(self, test)
def addError(self, test, err):
self.resultWriter.addError(test, err, self)
_TextTestResult.addError(self, test, err)
def addFailure(self, test, err):
self.resultWriter.addFailure(test, err, self)
_TextTestResult.addFailure(self, test, err)
class SharpDevelopTestRunner(TextTestRunner):
def __init__(self, stream=sys.stderr, resultsFileName=None, descriptions=1, verbosity=1):
self.stream = _WritelnDecorator(stream)
self.descriptions = descriptions
self.verbosity = verbosity
if resultsFileName is None:
self.resultWriter = _SharpDevelopNullTestResultWriter()
else:
self.resultWriter = _SharpDevelopTestResultWriter(resultsFileName)
def _makeResult(self):
return _SharpDevelopTestResult(self.stream, self.descriptions, self.verbosity, self.resultWriter)

71
src/AddIns/BackendBindings/Python/PythonBinding/Test/AddInOptionsTestFixture.cs

@ -1,71 +0,0 @@ @@ -1,71 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using ICSharpCode.Core;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests
{
/// <summary>
/// Tests the AddInOptions class.
/// </summary>
[TestFixture]
public class AddInOptionsTestFixture
{
[Test]
public void DefaultPythonConsoleFileName()
{
Properties p = new Properties();
DerivedAddInOptions options = new DerivedAddInOptions(p);
options.AddInPath = @"C:\Projects\SD\AddIns\Python";
string expectedFileName = Path.Combine(options.AddInPath, "ipy.exe");
Assert.AreEqual(expectedFileName, options.PythonFileName);
Assert.AreEqual("${addinpath:ICSharpCode.PythonBinding}", options.AddInPathRequested);
}
[Test]
public void SetPythonConsoleFileNameToNull()
{
Properties p = new Properties();
DerivedAddInOptions options = new DerivedAddInOptions(p);
options.AddInPath = @"C:\Projects\SD\AddIns\Python";
options.PythonFileName = null;
string expectedFileName = Path.Combine(options.AddInPath, "ipy.exe");
Assert.AreEqual(expectedFileName, options.PythonFileName);
}
[Test]
public void SetPythonConsoleFileNameToEmptyString()
{
Properties p = new Properties();
DerivedAddInOptions options = new DerivedAddInOptions(p);
options.AddInPath = @"C:\Projects\SD\AddIns\Python";
options.PythonFileName = String.Empty;
string expectedFileName = Path.Combine(options.AddInPath, "ipy.exe");
Assert.AreEqual(expectedFileName, options.PythonFileName);
}
[Test]
public void SetPythonConsoleFileName()
{
Properties p = new Properties();
AddInOptions options = new AddInOptions(p);
string fileName = @"C:\IronPython\ipy.exe";
options.PythonFileName = fileName;
Assert.AreEqual(fileName, options.PythonFileName);
Assert.AreEqual(fileName, p["PythonFileName"]);
}
}
}

52
src/AddIns/BackendBindings/Python/PythonBinding/Test/CodeCompletionBindingFromImportCompletionTestFixture.cs

@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.Core;
using ICSharpCode.PythonBinding;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests
{
/// <summary>
/// Tests that the From keyword is correctly identified as a
/// importable code completion keyword.
/// </summary>
[TestFixture]
public class FromImportCompletionTestFixture
{
DerivedPythonCodeCompletionBinding codeCompletionBinding;
bool handlesImportKeyword;
SharpDevelopTextAreaControl textAreaControl;
[TestFixtureSetUp]
public void SetUpFixture()
{
if (!PropertyService.Initialized) {
PropertyService.InitializeService(String.Empty, String.Empty, String.Empty);
}
textAreaControl = new SharpDevelopTextAreaControl();
codeCompletionBinding = new DerivedPythonCodeCompletionBinding();
handlesImportKeyword = codeCompletionBinding.HandleKeyword(textAreaControl, "from");
}
[Test]
public void HandlesImportKeyWord()
{
Assert.IsTrue(handlesImportKeyword);
}
[Test]
public void ExpressionContextIsImportable()
{
Assert.AreEqual(ExpressionContext.Importable, codeCompletionBinding.ExpressionContext);
}
}
}

6
src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/CodeCompletionBindingImportCompletionTestFixture.cs

@ -8,12 +8,12 @@ @@ -8,12 +8,12 @@
using System;
using ICSharpCode.Core;
using ICSharpCode.PythonBinding;
using ICSharpCode.SharpDevelop.Editor.AvalonEdit;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Editor.AvalonEdit;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests
namespace PythonBinding.Tests.Completion
{
/// <summary>
/// Tests the code completion after an "import" statement.
@ -48,7 +48,7 @@ namespace PythonBinding.Tests @@ -48,7 +48,7 @@ namespace PythonBinding.Tests
Assert.IsFalse(codeCompletionBinding.HandleKeyword(textEditor, "Unknown"));
}
[Test]
[Test]
public void HandlesUppercaseImportKeyword()
{
Assert.IsTrue(codeCompletionBinding.HandleKeyword(textEditor, "IMPORT"));

5
src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/NamespaceContentsAddedToCtrlSpaceTestFixture.cs

@ -12,6 +12,7 @@ using ICSharpCode.SharpDevelop.Dom; @@ -12,6 +12,7 @@ using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
using PythonBinding.Tests;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Resolver
{
@ -25,14 +26,14 @@ namespace PythonBinding.Tests.Resolver @@ -25,14 +26,14 @@ namespace PythonBinding.Tests.Resolver
{
List<ICompletionEntry> results;
PythonResolver resolver;
MockProjectContent mockProjectContent;
PythonBinding.Tests.Utils.MockProjectContent mockProjectContent;
MockClass myTestClass;
[TestFixtureSetUp]
public void SetUpFixture()
{
resolver = new PythonResolver();
mockProjectContent = new MockProjectContent();
mockProjectContent = new PythonBinding.Tests.Utils.MockProjectContent();
mockProjectContent.NamespacesToAdd.Add("Test");
myTestClass = new MockClass(mockProjectContent, "MyTestClass");
List<ICompletionEntry> namespaceItems = new List<ICompletionEntry>();

61
src/AddIns/BackendBindings/Python/PythonBinding/Test/AddInFileTestFixture.cs → src/AddIns/BackendBindings/Python/PythonBinding/Test/Configuration/AddInFileTestFixture.cs

@ -15,7 +15,7 @@ using ICSharpCode.TextEditor.Document; @@ -15,7 +15,7 @@ using ICSharpCode.TextEditor.Document;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests
namespace PythonBinding.Tests.Configuration
{
/// <summary>
/// Basic PythonBinding.addin file tests.
@ -50,6 +50,10 @@ namespace PythonBinding.Tests @@ -50,6 +50,10 @@ namespace PythonBinding.Tests
Codon convertCSharpProjectCodon;
Codon convertVBNetProjectCodon;
Codon formattingStrategyCodon;
Runtime sharpdevelopRuntime;
Runtime ironpythonModulesRuntime;
Runtime unitTestingRuntime;
Codon testFrameworkCodon;
[TestFixtureSetUp]
public void SetupFixture()
@ -83,13 +87,20 @@ namespace PythonBinding.Tests @@ -83,13 +87,20 @@ namespace PythonBinding.Tests
convertCSharpProjectCodon = GetCodon("/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions/Convert", "CSharpProjectToPythonProjectConverter");
convertVBNetProjectCodon = GetCodon("/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions/Convert", "VBNetProjectToPythonProjectConverter");
formattingStrategyCodon = GetCodon("/AddIns/DefaultTextEditor/Formatter/Python", "PythonFormatter");
testFrameworkCodon = GetCodon("/SharpDevelop/UnitTesting/TestFrameworks", "pyunit");
// Get the PythonBinding runtime.
foreach (Runtime runtime in addin.Runtimes) {
if (runtime.Assembly == "PythonBinding.dll") {
pythonBindingRuntime = runtime;
pythonBindingRuntime = runtime;
} else if (runtime.Assembly == "$ICSharpCode.FormsDesigner/FormsDesigner.dll") {
formsDesignerRuntime = runtime;
} else if (runtime.Assembly == "IronPython.Modules.dll") {
ironpythonModulesRuntime = runtime;
} else if (runtime.Assembly == ":ICSharpCode.SharpDevelop") {
sharpdevelopRuntime = runtime;
} else if (runtime.Assembly == "$ICSharpCode.UnitTesting/UnitTesting.dll") {
unitTestingRuntime = runtime;
}
}
@ -128,11 +139,29 @@ namespace PythonBinding.Tests @@ -128,11 +139,29 @@ namespace PythonBinding.Tests
}
[Test]
public void RuntimeExists()
public void PythonBindingRuntimeExists()
{
Assert.IsNotNull(pythonBindingRuntime);
}
[Test]
public void ICSharpCodeSharpDevelopRuntimeExists()
{
Assert.IsNotNull(sharpdevelopRuntime);
}
[Test]
public void IronPythonModulesRuntimeExists()
{
Assert.IsNotNull(ironpythonModulesRuntime);
}
[Test]
public void UnitTestingRuntimeExists()
{
Assert.IsNotNull(unitTestingRuntime);
}
[Test]
public void FileFilterExists()
{
@ -725,22 +754,40 @@ namespace PythonBinding.Tests @@ -725,22 +754,40 @@ namespace PythonBinding.Tests
{
Assert.AreEqual(1, pythonWithoutDebuggerRunMenuItemCodon.Conditions.Length);
}
[Test]
public void PythonDebugRunConditionIsSameAsPythonRunCondition()
{
Assert.AreEqual(pythonWithoutDebuggerRunMenuItemCodon.Conditions[0], pythonRunMenuItemCodon.Conditions[0]);
}
[Test]
public void PythonFormatterClass()
{
Assert.AreEqual("ICSharpCode.PythonBinding.PythonFormattingStrategy", formattingStrategyCodon["class"]);
}
[Test]
public void TestFrameworkCodonExists()
{
Assert.IsNotNull(testFrameworkCodon);
}
[Test]
public void TestFrameworkClassIsPythonTestFrameworks()
{
Assert.AreEqual("ICSharpCode.PythonBinding.PythonTestFramework", testFrameworkCodon["class"]);
}
[Test]
public void TestFrameworkSupportedProjectsIsPythonProject()
{
Assert.AreEqual(".pyproj", testFrameworkCodon["supportedProjects"]);
}
Codon GetCodon(string name, string extensionPath)
{
return AddInHelper.GetCodon(addin, name, extensionPath);
}
}
}
}

94
src/AddIns/BackendBindings/Python/PythonBinding/Test/Configuration/AddInOptionsTestFixture.cs

@ -0,0 +1,94 @@ @@ -0,0 +1,94 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using ICSharpCode.Core;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests.Configuration
{
/// <summary>
/// Tests the AddInOptions class.
/// </summary>
[TestFixture]
public class AddInOptionsTestFixture
{
AddInOptions options;
Properties properties;
AddIn addin;
[TestFixtureSetUp]
public void SetUpFixture()
{
addin = AddInPathHelper.CreateDummyPythonAddInInsideAddInTree();
addin.FileName = @"C:\Projects\SD\AddIns\Python\pythonbinding.addin";
}
[SetUp]
public void Init()
{
properties = new Properties();
options = new AddInOptions(properties);
}
[Test]
public void DefaultPythonConsoleFileNameIsPythonAddInPathCombinedWithIpyExe()
{
string expectedFileName = @"C:\Projects\SD\AddIns\Python\ipy.exe";
Assert.AreEqual(expectedFileName, options.PythonFileName);
}
[Test]
public void RequestingPythonFileNameWhenPythonConsoleFileNameSetToNullReturnsDefaultPythonConsoleFileName()
{
options.PythonFileName = null;
string expectedFileName = @"C:\Projects\SD\AddIns\Python\ipy.exe";
Assert.AreEqual(expectedFileName, options.PythonFileName);
}
[Test]
public void RequestingPythonFileNameWhenPythonConsoleFileNameToEmptyStringReturnsDefaultPythonConsoleFileName()
{
options.PythonFileName = String.Empty;
string expectedFileName = @"C:\Projects\SD\AddIns\Python\ipy.exe";
Assert.AreEqual(expectedFileName, options.PythonFileName);
}
[Test]
public void SetPythonConsoleFileNameUpdatesAddInOptionsPythonFileName()
{
string fileName = @"C:\IronPython\ipy.exe";
options.PythonFileName = fileName;
Assert.AreEqual(fileName, options.PythonFileName);
}
[Test]
public void SetPythonConsoleFileNameUpdatesProperties()
{
string fileName = @"C:\IronPython\ipy.exe";
options.PythonFileName = fileName;
Assert.AreEqual(fileName, properties["PythonFileName"]);
}
[Test]
public void PythonLibraryPathTakenFromProperties()
{
string expectedPythonLibraryPath = @"c:\python26\lib;c:\python26\lib\lib-tk";
properties["PythonLibraryPath"] = expectedPythonLibraryPath;
Assert.AreEqual(expectedPythonLibraryPath, options.PythonLibraryPath);
}
[Test]
public void DefaultPythonLibraryPathIsEmptyString()
{
Assert.AreEqual(String.Empty, options.PythonLibraryPath);
}
}
}

3
src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForLoopConversionTestFixture.cs

@ -51,7 +51,6 @@ namespace PythonBinding.Tests.Converter @@ -51,7 +51,6 @@ namespace PythonBinding.Tests.Converter
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string code = converter.Convert(csharp);
System.Console.WriteLine(code);
string expectedCode = "class Foo(object):\r\n" +
"\tdef GetCount(self):\r\n" +
"\t\tcount = 0\r\n" +
@ -60,7 +59,7 @@ namespace PythonBinding.Tests.Converter @@ -60,7 +59,7 @@ namespace PythonBinding.Tests.Converter
"\t\t\tcount += 1\r\n" +
"\t\t\ti = i + 1\r\n" +
"\t\treturn count";
Assert.AreEqual(expectedCode, code);
}
}

5
src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ProjectHasStartupObjectTestFixture.cs

@ -17,6 +17,7 @@ using ICSharpCode.SharpDevelop; @@ -17,6 +17,7 @@ using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Converter
{
@ -31,7 +32,7 @@ namespace PythonBinding.Tests.Converter @@ -31,7 +32,7 @@ namespace PythonBinding.Tests.Converter
MSBuildBasedProject sourceProject;
PythonProject targetProject;
MockTextEditorProperties mockTextEditorProperties;
MockProjectContent mockProjectContent;
PythonBinding.Tests.Utils.MockProjectContent mockProjectContent;
string startupObject = "RootNamespace.Main";
@ -64,7 +65,7 @@ namespace PythonBinding.Tests.Converter @@ -64,7 +65,7 @@ namespace PythonBinding.Tests.Converter
// Set up IProjectContent so the ConvertProjectToPythonProjectCommand can
// locate the startup object and determine it's filename.
mockProjectContent = new MockProjectContent();
mockProjectContent = new PythonBinding.Tests.Utils.MockProjectContent();
MockClass mainClass = new MockClass(mockProjectContent, startupObject);
mainClass.CompilationUnit.FileName = @"d:\projects\test\src\Main2.cs";
mockProjectContent.ClassToReturnFromGetClass = mainClass;

3
src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratorMergeFindsInitializeComponentsTestFixture.cs

@ -20,6 +20,7 @@ using ICSharpCode.FormsDesigner; @@ -20,6 +20,7 @@ using ICSharpCode.FormsDesigner;
using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Designer
{
@ -71,7 +72,7 @@ namespace PythonBinding.Tests.Designer @@ -71,7 +72,7 @@ namespace PythonBinding.Tests.Designer
[Test]
public void GetDomRegion()
{
MockMethod method = new MockMethod();
MockMethod method = new MockMethod(MockClass.CreateMockClassWithoutAnyAttributes());
DomRegion bodyRegion = new DomRegion(0, 4, 1, 4);
method.BodyRegion = bodyRegion;
DomRegion expectedRegion = new DomRegion(bodyRegion.BeginLine + 1, 1, bodyRegion.EndLine + 1, 1);

2
src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonDesignerLoaderTestFixture.cs

@ -68,9 +68,7 @@ namespace PythonBinding.Tests.Designer @@ -68,9 +68,7 @@ namespace PythonBinding.Tests.Designer
serializationManager = new DesignerSerializationManager(mockDesignerLoaderHost);
System.Console.WriteLine("Before BeginLoad");
loader.BeginLoad(mockDesignerLoaderHost);
System.Console.WriteLine("After BeginLoad");
rootComponent = mockDesignerLoaderHost.RootComponent;
designedForm = new Form();

3
src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonGeneratorTestFixture.cs

@ -17,6 +17,7 @@ using ICSharpCode.SharpDevelop; @@ -17,6 +17,7 @@ using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Designer
{
@ -26,7 +27,7 @@ namespace PythonBinding.Tests.Designer @@ -26,7 +27,7 @@ namespace PythonBinding.Tests.Designer
[Test]
public void GetMethodReplaceRegion()
{
MockMethod method = new MockMethod();
MockMethod method = new MockMethod(MockClass.CreateMockClassWithoutAnyAttributes());
DomRegion bodyRegion = new DomRegion(0, 4, 1, 4);
method.BodyRegion = bodyRegion;
DomRegion expectedRegion = new DomRegion(bodyRegion.BeginLine + 1, 1, bodyRegion.EndLine + 1, 1);

2
src/AddIns/BackendBindings/Python/PythonBinding/Test/AppSettingsPanelTestFixture.cs → src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/AppSettingsPanelTestFixture.cs

@ -16,7 +16,7 @@ using ICSharpCode.SharpDevelop.Project; @@ -16,7 +16,7 @@ using ICSharpCode.SharpDevelop.Project;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests
namespace PythonBinding.Tests.Gui
{
/// <summary>
/// Tests the ApplicationSettingsPanel class.

2
src/AddIns/BackendBindings/Python/PythonBinding/Test/CompilingOptionsPanelTestFixture.cs → src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/CompilingOptionsPanelTestFixture.cs

@ -16,7 +16,7 @@ using ICSharpCode.SharpDevelop.Project; @@ -16,7 +16,7 @@ using ICSharpCode.SharpDevelop.Project;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests
namespace PythonBinding.Tests.Gui
{
/// <summary>
/// Tests the CompilingOptionsPanel.

6
src/AddIns/BackendBindings/Python/PythonBinding/Test/DebugPythonCommandTestFixture.cs → src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/DebugPythonCommandTestFixture.cs

@ -13,7 +13,7 @@ using ICSharpCode.PythonBinding; @@ -13,7 +13,7 @@ using ICSharpCode.PythonBinding;
using PythonBinding.Tests.Utils;
using NUnit.Framework;
namespace PythonBinding.Tests
namespace PythonBinding.Tests.Gui
{
[TestFixture]
public class DebugPythonCommandTestFixture
@ -26,7 +26,7 @@ namespace PythonBinding.Tests @@ -26,7 +26,7 @@ namespace PythonBinding.Tests
{
// Create dummy view content with the Python script.
MockViewContent viewContent = new MockViewContent();
viewContent.PrimaryFileName = new FileName(@"C:\Projects\test.py");
viewContent.PrimaryFileName = new FileName(@"C:\Projects\test.py");
MockWorkbenchWindow workbenchWindow = new MockWorkbenchWindow();
workbenchWindow.ActiveViewContent = viewContent;
MockWorkbench workbench = new MockWorkbench();
@ -57,7 +57,7 @@ namespace PythonBinding.Tests @@ -57,7 +57,7 @@ namespace PythonBinding.Tests
[Test]
public void ProcessInfoArgs()
{
Assert.AreEqual("-D \"C:\\Projects\\test.py\"", debugger.ProcessStartInfo.Arguments);
Assert.AreEqual("-X:Debug \"C:\\Projects\\test.py\"", debugger.ProcessStartInfo.Arguments);
}
}
}

9
src/AddIns/BackendBindings/Python/PythonBinding/Test/FormsDesignerDisplayBindingTestFixture.cs → src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/FormsDesignerDisplayBindingTestFixture.cs

@ -8,12 +8,13 @@ @@ -8,12 +8,13 @@
using System;
using ICSharpCode.FormsDesigner;
using ICSharpCode.PythonBinding;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests
namespace PythonBinding.Tests.Gui
{
/// <summary>
/// Tests the PythonFormsDesignerDisplayBinding.
@ -23,8 +24,8 @@ namespace PythonBinding.Tests @@ -23,8 +24,8 @@ namespace PythonBinding.Tests
{
DerivedPythonFormsDesignerDisplayBinding displayBinding;
MockTextEditorViewContent viewContent;
ParseInformation parseInfo;
bool canAttachToDesignableClass;
ParseInformation parseInfo;
[SetUp]
public void SetUp()
@ -32,7 +33,7 @@ namespace PythonBinding.Tests @@ -32,7 +33,7 @@ namespace PythonBinding.Tests
displayBinding = new DerivedPythonFormsDesignerDisplayBinding();
viewContent = new MockTextEditorViewContent();
parseInfo = new ParseInformation(new DefaultCompilationUnit(new DefaultProjectContent()));
viewContent.PrimaryFileName = new ICSharpCode.Core.FileName("test.py");
viewContent.PrimaryFileName = new FileName("test.py");
viewContent.TextEditor.Document.Text = "text content";
displayBinding.ParseServiceParseInfoToReturn = parseInfo;
displayBinding.IsParseInfoDesignable = true;
@ -99,7 +100,7 @@ namespace PythonBinding.Tests @@ -99,7 +100,7 @@ namespace PythonBinding.Tests
[Test]
public void NonPythonFileNameCannotBeAttachedTo()
{
viewContent.PrimaryFileName = new ICSharpCode.Core.FileName("test.cs");
viewContent.PrimaryFileName = new FileName("test.cs");
Assert.IsFalse(displayBinding.CanAttachTo(viewContent));
}

4
src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonIndentationTests.cs → src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/PythonIndentationTests.cs

@ -13,13 +13,13 @@ using ICSharpCode.TextEditor.Actions; @@ -13,13 +13,13 @@ using ICSharpCode.TextEditor.Actions;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests.Indentation
namespace PythonBinding.Tests
{
/// <summary>
/// Tests that the PythonFormattingStrategy indents the new line added after pressing the ':' character.
/// </summary>
[TestFixture]
public class PythonNewMethodIndentationTestFixture
public class PythonIndentationTestFixture
{
TextEditorControl textEditor;
PythonFormattingStrategy formattingStrategy;

26
src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonOptionsPanelTestFixture.cs → src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/PythonOptionsPanelTestFixture.cs

@ -5,16 +5,16 @@ @@ -5,16 +5,16 @@
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using System;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.PythonBinding;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using NUnit.Framework;
namespace PythonBinding.Tests
namespace PythonBinding.Tests.Gui
{
/// <summary>
/// Tests the PythonOptionsPanel.
@ -26,6 +26,7 @@ namespace PythonBinding.Tests @@ -26,6 +26,7 @@ namespace PythonBinding.Tests
Properties properties;
AddInOptions options;
TextBox fileNameTextBox;
TextBox pythonLibraryPathTextBox;
[SetUp]
public void SetUp()
@ -33,9 +34,11 @@ namespace PythonBinding.Tests @@ -33,9 +34,11 @@ namespace PythonBinding.Tests
properties = new Properties();
options = new AddInOptions(properties);
options.PythonFileName = @"C:\Python\ipy.exe";
options.PythonLibraryPath = @"C:\Python26\lib";
optionsPanel = new PythonOptionsPanel(options);
optionsPanel.LoadPanelContents();
fileNameTextBox = (TextBox)optionsPanel.ControlDictionary["pythonFileNameTextBox"];
pythonLibraryPathTextBox = (TextBox)optionsPanel.ControlDictionary["pythonLibraryPathTextBox"];
}
[TearDown]
@ -47,7 +50,13 @@ namespace PythonBinding.Tests @@ -47,7 +50,13 @@ namespace PythonBinding.Tests
[Test]
public void PythonFileNameDisplayed()
{
Assert.AreEqual(options.PythonFileName, fileNameTextBox.Text);
Assert.AreEqual(@"C:\Python\ipy.exe", fileNameTextBox.Text);
}
[Test]
public void PythonLibraryPathIsDisplayed()
{
Assert.AreEqual(@"C:\Python26\lib", pythonLibraryPathTextBox.Text);
}
[Test]
@ -57,12 +66,21 @@ namespace PythonBinding.Tests @@ -57,12 +66,21 @@ namespace PythonBinding.Tests
}
[Test]
public void SaveOptions()
public void SavingOptionsUpdatesIronPythonFileName()
{
string fileName = @"C:\Program Files\IronPython\ipy.exe";
fileNameTextBox.Text = fileName;
optionsPanel.StorePanelContents();
Assert.AreEqual(fileName, options.PythonFileName);
}
[Test]
public void SavingOptionsUpdatesIronPythonLibraryPath()
{
string path = @"c:\Program Files\Python\lib";
pythonLibraryPathTextBox.Text = path;
optionsPanel.StorePanelContents();
Assert.AreEqual(path, options.PythonLibraryPath);
}
}
}

3
src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonSyntaxModeTestFixture.cs → src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/PythonSyntaxModeTestFixture.cs

@ -16,8 +16,9 @@ using ICSharpCode.AvalonEdit.AddIn; @@ -16,8 +16,9 @@ using ICSharpCode.AvalonEdit.AddIn;
using ICSharpCode.Core;
using ICSharpCode.TextEditor.Document;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests
namespace PythonBinding.Tests.Gui
{
/// <summary>
/// Tests the Python.xshd syntax mode information.

2
src/AddIns/BackendBindings/Python/PythonBinding/Test/RunPythonCommandTestFixture.cs → src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/RunPythonCommandTestFixture.cs

@ -13,7 +13,7 @@ using ICSharpCode.SharpDevelop.Gui; @@ -13,7 +13,7 @@ using ICSharpCode.SharpDevelop.Gui;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests
namespace PythonBinding.Tests.Gui
{
/// <summary>
/// Tests that the RunPythonCommand class runs the Python console

1
src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ClassWithBaseClassTestFixture.cs

@ -52,6 +52,5 @@ namespace PythonBinding.Tests.Parsing @@ -52,6 +52,5 @@ namespace PythonBinding.Tests.Parsing
}
Assert.IsNotNull(matchedBaseType);
}
}
}

59
src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassNestedInsideMethodTestFixture.cs

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using ICSharpCode.PythonBinding;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.TextEditor.Document;
using NUnit.Framework;
using PythonBinding.Tests;
namespace PythonBinding.Tests.Parsing
{
[TestFixture]
public class ParseClassNestedInsideMethodTestFixture
{
ICompilationUnit compilationUnit;
IClass c;
[SetUp]
public void SetUpFixture()
{
string python =
"class MyClass:\r\n" +
" def firstMethod(self):\r\n" +
" class NestedClass:\r\n" +
" def firstNestedClassMethod(self):\r\n" +
" pass\r\n" +
"\r\n" +
" def secondMethod(self):\r\n" +
" pass\r\n" +
"\r\n";
DefaultProjectContent projectContent = new DefaultProjectContent();
PythonParser parser = new PythonParser();
compilationUnit = parser.Parse(projectContent, @"C:\test.py", python);
if (compilationUnit.Classes.Count > 0) {
c = compilationUnit.Classes[0];
}
}
[Test]
public void CompilationUnitHasOneClass()
{
Assert.AreEqual(1, compilationUnit.Classes.Count);
}
[Test]
public void MyClassHasTwoMethods()
{
Assert.AreEqual(2, c.Methods.Count);
}
}
}

52
src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseTestClassTestFixture.cs

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.PythonBinding;
using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
namespace PythonBinding.Tests.Parsing
{
[TestFixture]
public class ParseTestClassTestFixture
{
ICompilationUnit compilationUnit;
IClass c;
[TestFixtureSetUp]
public void SetUpFixture()
{
string python =
"import unittest\r\n" +
"\r\n" +
"class simpleTest(unittest.TestCase):\r\n" +
" def testSuccess(self):\r\n" +
" assert True\r\n" +
"\r\n" +
" def testFailure(self):\r\n" +
" assert False\r\n" +
"\r\n";
DefaultProjectContent projectContent = new DefaultProjectContent();
PythonParser parser = new PythonParser();
compilationUnit = parser.Parse(projectContent, @"C:\test.py", python);
if (compilationUnit.Classes.Count > 0) {
c = compilationUnit.Classes[0];
}
}
[Test]
public void SimpleTestFirstBaseTypeIsUnitTestTestCase()
{
IReturnType baseType = c.BaseTypes[0];
string actualBaseTypeName = baseType.FullyQualifiedName;
string expectedBaseTypeName = "unittest.TestCase";
Assert.AreEqual(expectedBaseTypeName, actualBaseTypeName);
}
}
}

89
src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseTestClassWithBaseClassTestFixture.cs

@ -0,0 +1,89 @@ @@ -0,0 +1,89 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.PythonBinding;
using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
namespace PythonBinding.Tests.Parsing
{
[TestFixture]
public class ParseTestClassWithBaseClassTestFixture
{
ICompilationUnit compilationUnit;
IClass c;
DefaultProjectContent projectContent;
[TestFixtureSetUp]
public void SetUpFixture()
{
string python =
"import unittest\r\n" +
"\r\n" +
"class BaseTest(unittest.TestCase):\r\n" +
" def testSuccess(self):\r\n" +
" assert True\r\n" +
"\r\n" +
"class DerivedTest(BaseTest):\r\n" +
" pass\r\n" +
"\r\n";
projectContent = new DefaultProjectContent();
PythonParser parser = new PythonParser();
string fileName = @"C:\test.py";
compilationUnit = parser.Parse(projectContent, fileName, python);
projectContent.UpdateCompilationUnit(null, compilationUnit, fileName);
if (compilationUnit.Classes.Count > 1) {
c = compilationUnit.Classes[1];
}
}
[Test]
public void DerivedTestFirstBaseTypeIsBaseTestTestCase()
{
IReturnType baseType = c.BaseTypes[0];
string actualBaseTypeName = baseType.FullyQualifiedName;
string expectedBaseTypeName = "test.BaseTest";
Assert.AreEqual(expectedBaseTypeName, actualBaseTypeName);
}
[Test]
public void DerivedTestBaseClassNameIsBaseTest()
{
IClass baseClass = c.BaseClass;
string actualName = baseClass.FullyQualifiedName;
string expectedName = "test.BaseTest";
Assert.AreEqual(expectedName, actualName);
}
[Test]
public void ProjectContentGetClassReturnsBaseTest()
{
IClass c = projectContent.GetClass("test.BaseTest", 0);
Assert.AreEqual("test.BaseTest", c.FullyQualifiedName);
}
[Test]
public void CompilationUnitUsingScopeNamespaceNameIsNamespaceTakenFromFileName()
{
string expectedNamespace = "test";
Assert.AreEqual(expectedNamespace, compilationUnit.UsingScope.NamespaceName);
}
[Test]
public void DerivedTestBaseClassHasTestCaseBaseClass()
{
IReturnType baseType = c.BaseTypes[0];
IClass baseClass = baseType.GetUnderlyingClass();
IReturnType baseBaseType = baseClass.BaseTypes[0];
string actualBaseTypeName = baseBaseType.FullyQualifiedName;
string expectedBaseTypeName = "unittest.TestCase";
Assert.AreEqual(expectedBaseTypeName, actualBaseTypeName);
}
}
}

69
src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj

@ -79,11 +79,7 @@ @@ -79,11 +79,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AddInOptionsTestFixture.cs" />
<Compile Include="AppSettingsPanelTestFixture.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="AddInFileTestFixture.cs" />
<Compile Include="CompilingOptionsPanelTestFixture.cs" />
<Compile Include="Completion\CodeCompletionBindingFromImportCompletionTestFixture.cs" />
<Compile Include="Completion\CodeCompletionBindingImportCompletionTestFixture.cs" />
<Compile Include="Completion\FromDateTimeImportCompletionTestFixture.cs" />
@ -104,6 +100,8 @@ @@ -104,6 +100,8 @@
<Compile Include="Completion\PythonImportExpressionContextTestFixture.cs" />
<Compile Include="Completion\PythonSocketLibraryDocumentationTestFixture.cs" />
<Compile Include="Completion\SysModuleMembersInPythonContextTestFixture.cs" />
<Compile Include="Configuration\AddInFileTestFixture.cs" />
<Compile Include="Configuration\AddInOptionsTestFixture.cs" />
<Compile Include="Console\BuiltinCodeCompletionTestFixture.cs" />
<Compile Include="Console\KeysPressedWhenCompletionWindowOpenTestFixture.cs" />
<Compile Include="Console\CommandLineHistoryTestFixture.cs" />
@ -199,7 +197,6 @@ @@ -199,7 +197,6 @@
<Compile Include="Converter\VBStringConcatTestFixture.cs" />
<Compile Include="Converter\WhileLoopConversionTestFixture.cs" />
<Compile Include="Converter\XmlDocCommentConversionTestFixture.cs" />
<Compile Include="DebugPythonCommandTestFixture.cs" />
<Compile Include="Designer\AppendNullPropertyValueTestFixture.cs" />
<Compile Include="Designer\CallBeginInitOnLoadTestFixture.cs" />
<Compile Include="Designer\ConvertCustomClassUsingTypeConverterTestFixture.cs" />
@ -342,12 +339,19 @@ @@ -342,12 +339,19 @@
<Compile Include="Expressions\ParseSimpleImportExpressionTestFixture.cs" />
<Compile Include="Expressions\RemoveLastPartTests.cs" />
<Compile Include="Expressions\StringTextContentProviderTests.cs" />
<Compile Include="FormsDesignerDisplayBindingTestFixture.cs" />
<Compile Include="ProjectBindingTestFixture.cs" />
<Compile Include="Gui\AppSettingsPanelTestFixture.cs" />
<Compile Include="Gui\CompilingOptionsPanelTestFixture.cs" />
<Compile Include="Gui\DebugPythonCommandTestFixture.cs" />
<Compile Include="Gui\FormsDesignerDisplayBindingTestFixture.cs" />
<Compile Include="Gui\PythonIndentationTests.cs" />
<Compile Include="Gui\PythonOptionsPanelTestFixture.cs" />
<Compile Include="Gui\PythonSyntaxModeTestFixture.cs" />
<Compile Include="Gui\RunPythonCommandTestFixture.cs" />
<Compile Include="Parsing\ClassWithBaseClassTestFixture.cs" />
<Compile Include="Parsing\InvalidCastInPythonParserTestFixture.cs" />
<Compile Include="Parsing\MethodWithParametersTestFixture.cs" />
<Compile Include="Parsing\MissingLastParameterFromMethodTestFixture.cs" />
<Compile Include="Parsing\ParseClassNestedInsideMethodTestFixture.cs" />
<Compile Include="Parsing\ParseClassWithCtorTestFixture.cs" />
<Compile Include="Parsing\ParseClassWithMethodTestFixture.cs" />
<Compile Include="Parsing\ParseFromMathImportAllTestFixture.cs" />
@ -364,12 +368,11 @@ @@ -364,12 +368,11 @@
<Compile Include="Parsing\ParserTestFixture.cs" />
<Compile Include="Parsing\ParseSingleClassTestFixture.cs" />
<Compile Include="Parsing\InvalidClassTestFixture.cs" />
<Compile Include="PythonBindingAddInFile.cs" />
<Compile Include="PythonIndentationTests.cs" />
<Compile Include="PythonLanguagePropertiesTests.cs" />
<Compile Include="PythonOptionsPanelTestFixture.cs" />
<Compile Include="CreateNewPythonProjectTestFixture.cs" />
<Compile Include="PythonSyntaxModeTestFixture.cs" />
<Compile Include="Parsing\ParseTestClassTestFixture.cs" />
<Compile Include="Parsing\ParseTestClassWithBaseClassTestFixture.cs" />
<Compile Include="PythonLanguage\CreateNewPythonProjectTestFixture.cs" />
<Compile Include="PythonLanguage\ProjectBindingTestFixture.cs" />
<Compile Include="PythonLanguage\PythonLanguagePropertiesTests.cs" />
<Compile Include="Resolver\ImportModuleResolveResultTests.cs" />
<Compile Include="Resolver\InvalidResolveInputsTestFixture.cs" />
<Compile Include="Resolver\MemberNameTests.cs" />
@ -416,9 +419,22 @@ @@ -416,9 +419,22 @@
<Compile Include="Resolver\ResolveTextBoxFromSystemWindowsFormsImportedAsMyTextBoxTestFixture.cs" />
<Compile Include="Resolver\ResolveTextBoxFromSystemWindowsFormsImportTextBoxTestFixture.cs" />
<Compile Include="Resolver\ResolveUnknownNamespaceTestFixture.cs" />
<Compile Include="RunPythonCommandTestFixture.cs" />
<Compile Include="Testing\CreatePythonTestRunnerTestFixture.cs" />
<Compile Include="Testing\CreateTextWriterFromCreateTextWriterInfoTestFixture.cs" />
<Compile Include="Testing\CreateTextWriterInfoEqualsTestFixture.cs" />
<Compile Include="Testing\PythonConsoleApplicationTestFixture.cs" />
<Compile Include="Testing\PythonStandardLibraryPathTests.cs" />
<Compile Include="Testing\PythonTestDebuggerRunsSelectedTestMethodTestFixture.cs" />
<Compile Include="Testing\PythonTestFrameworkIsTestClassTests.cs" />
<Compile Include="Testing\PythonTestFrameworkIsTestMethodTests.cs" />
<Compile Include="Testing\PythonTestFrameworkIsTestProjectTests.cs" />
<Compile Include="Testing\PythonTestResultFailureTestFixture.cs" />
<Compile Include="Testing\PythonTestResultStackTraceLineNumberOverflowTestFixture.cs" />
<Compile Include="Testing\PythonTestRunnerResponseFileTestFixture.cs" />
<Compile Include="Testing\PythonTestRunnerRunsSelectedTestMethodTestFixture.cs" />
<Compile Include="Utils\AddedComponent.cs" />
<Compile Include="Utils\AddInHelper.cs" />
<Compile Include="Utils\AddInPathHelper.cs" />
<Compile Include="Utils\BarItemCollection.cs" />
<Compile Include="Utils\BrowseButtonInfo.cs" />
<Compile Include="Utils\BrowseFolderButtonInfo.cs" />
@ -426,7 +442,6 @@ @@ -426,7 +442,6 @@
<Compile Include="Utils\CreatedComponent.cs" />
<Compile Include="Utils\CreatedInstance.cs" />
<Compile Include="Utils\CustomUserControl.cs" />
<Compile Include="Utils\DerivedAddInOptions.cs" />
<Compile Include="Utils\DerivedApplicationSettingsPanel.cs" />
<Compile Include="Utils\DerivedCompilingOptionsPanel.cs" />
<Compile Include="Utils\DerivedConvertProjectToPythonProjectCommand.cs" />
@ -437,8 +452,9 @@ @@ -437,8 +452,9 @@
<Compile Include="Utils\DerivedPythonFormsDesignerDisplayBinding.cs" />
<Compile Include="Utils\DerivedToolStripMenuItem.cs" />
<Compile Include="Utils\DoublePropertyUserControl.cs" />
<Compile Include="Utils\DummyServiceManager.cs" />
<Compile Include="Utils\DummySynchronizeInvoke.cs" />
<Compile Include="Utils\FooItemCollection.cs" />
<Compile Include="Utils\MockClass.cs" />
<Compile Include="Utils\MockComponentCreator.cs" />
<Compile Include="Utils\MockDebugger.cs" />
<Compile Include="Utils\MockDesignerGenerator.cs" />
@ -447,12 +463,12 @@ @@ -447,12 +463,12 @@
<Compile Include="Utils\MockEventBindingService.cs" />
<Compile Include="Utils\MockEventDescriptor.cs" />
<Compile Include="Utils\MockExtenderProviderService.cs" />
<Compile Include="Utils\MockMethod.cs" />
<Compile Include="Utils\MockOpenedFile.cs" />
<Compile Include="Utils\MockPadDescriptor.cs" />
<Compile Include="Utils\MockProject.cs" />
<Compile Include="Utils\MockProjectContent.cs" />
<Compile Include="Utils\MockPropertyDescriptor.cs" />
<Compile Include="Utils\MockPythonFileService.cs" />
<Compile Include="Utils\MockResourceReader.cs" />
<Compile Include="Utils\MockResourceService.cs" />
<Compile Include="Utils\MockResourceWriter.cs" />
@ -463,6 +479,7 @@ @@ -463,6 +479,7 @@
<Compile Include="Utils\MockWorkbench.cs" />
<Compile Include="Utils\MockWorkbenchWindow.cs" />
<Compile Include="Utils\MSBuildEngineHelper.cs" />
<Compile Include="Utils\Tests\AddInPathHelperTestFixture.cs" />
<EmbeddedResource Include="..\Project\PythonBinding.addin">
<Link>PythonBinding.addin</Link>
</EmbeddedResource>
@ -472,11 +489,13 @@ @@ -472,11 +489,13 @@
<None Include="app.config" />
<Compile Include="Parsing\AddInvalidSourceSpanToErrorSinkTestFixture.cs" />
<Compile Include="Utils\NullPropertyUserControl.cs" />
<Compile Include="Utils\PythonBindingAddInFile.cs" />
<Compile Include="Utils\PythonCompletionItemsHelper.cs" />
<Compile Include="Utils\PythonParserHelper.cs" />
<Compile Include="Utils\SupportInitCustomControl.cs" />
<Compile Include="Utils\Tests\MockComponentCreatorTests.cs" />
<Compile Include="Utils\Tests\MockProjectContentTests.cs" />
<Compile Include="Utils\Tests\MockPythonFileServiceTestFixture.cs" />
<Compile Include="Utils\Tests\PythonCompletionItemsHelperTests.cs" />
<Compile Include="Utils\Tests\PythonParserHelperTests.cs" />
<EmbeddedResource Include="Designer\App.ico" />
@ -504,6 +523,10 @@ @@ -504,6 +523,10 @@
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj">
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project>
<Name>ICSharpCode.Core.WinForms</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
@ -512,6 +535,14 @@ @@ -512,6 +535,14 @@
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project>
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Analysis\UnitTesting\Test\UnitTesting.Tests.csproj">
<Project>{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}</Project>
<Name>UnitTesting.Tests</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Analysis\UnitTesting\UnitTesting.csproj">
<Project>{1F261725-6318-4434-A1B1-6C70CE4CD324}</Project>
<Name>UnitTesting</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj">
<Project>{0162E499-42D0-409B-AA25-EED21F75336B}</Project>
<Name>AvalonEdit.AddIn</Name>
@ -529,6 +560,10 @@ @@ -529,6 +560,10 @@
<Folder Include="Converter" />
<Folder Include="Console" />
<Folder Include="Completion" />
<Folder Include="Configuration" />
<Folder Include="Gui" />
<Folder Include="Testing" />
<Folder Include="PythonLanguage" />
<Folder Include="Parsing" />
<Folder Include="Resolver" />
<Folder Include="Utils" />

0
src/AddIns/BackendBindings/Python/PythonBinding/Test/CreateNewPythonProjectTestFixture.cs → src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/CreateNewPythonProjectTestFixture.cs

0
src/AddIns/BackendBindings/Python/PythonBinding/Test/ProjectBindingTestFixture.cs → src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/ProjectBindingTestFixture.cs

0
src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguagePropertiesTests.cs → src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/PythonLanguagePropertiesTests.cs

1
src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveConsoleFromSystemImportEverythingFixture.cs

@ -13,6 +13,7 @@ using ICSharpCode.SharpDevelop.Dom; @@ -13,6 +13,7 @@ using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.CSharp;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Resolver
{

1
src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveConsoleWriteLineTestFixture.cs

@ -12,6 +12,7 @@ using ICSharpCode.SharpDevelop.Dom; @@ -12,6 +12,7 @@ using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
using PythonBinding.Tests;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Resolver
{

1
src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFooTextBoxFromSystemWindowsFormsImportedAsFooTestFixture.cs

@ -13,6 +13,7 @@ using ICSharpCode.SharpDevelop.Dom; @@ -13,6 +13,7 @@ using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.CSharp;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Resolver
{

5
src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveLocalClassInstanceTestFixture.cs

@ -12,6 +12,7 @@ using ICSharpCode.SharpDevelop.Dom; @@ -12,6 +12,7 @@ using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
using PythonBinding.Tests;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Resolver
{
@ -27,7 +28,7 @@ namespace PythonBinding.Tests.Resolver @@ -27,7 +28,7 @@ namespace PythonBinding.Tests.Resolver
public class ResolveLocalClassInstanceTestFixture
{
PythonResolver resolver;
MockProjectContent mockProjectContent;
PythonBinding.Tests.Utils.MockProjectContent mockProjectContent;
LocalResolveResult resolveResult;
MockClass testClass;
ICompilationUnit compilationUnit;
@ -37,7 +38,7 @@ namespace PythonBinding.Tests.Resolver @@ -37,7 +38,7 @@ namespace PythonBinding.Tests.Resolver
{
resolver = new PythonResolver();
mockProjectContent = new MockProjectContent();
mockProjectContent = new PythonBinding.Tests.Utils.MockProjectContent();
testClass = new MockClass(mockProjectContent, "Test.Test1");
mockProjectContent.ClassesInProjectContent.Add(testClass);
mockProjectContent.ClassToReturnFromGetClass = testClass;

7
src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemConsoleTestFixture.cs

@ -12,6 +12,7 @@ using ICSharpCode.SharpDevelop.Dom; @@ -12,6 +12,7 @@ using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
using PythonBinding.Tests;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Resolver
{
@ -23,7 +24,7 @@ namespace PythonBinding.Tests.Resolver @@ -23,7 +24,7 @@ namespace PythonBinding.Tests.Resolver
public class ResolveSystemConsoleTestFixture
{
PythonResolver resolver;
MockProjectContent mockProjectContent;
PythonBinding.Tests.Utils.MockProjectContent mockProjectContent;
ResolveResult resolveResult;
MockClass testClass;
ICompilationUnit compilationUnit;
@ -34,7 +35,7 @@ namespace PythonBinding.Tests.Resolver @@ -34,7 +35,7 @@ namespace PythonBinding.Tests.Resolver
public void SetUpFixture()
{
resolver = new PythonResolver();
mockProjectContent = new MockProjectContent();
mockProjectContent = new PythonBinding.Tests.Utils.MockProjectContent();
systemConsoleClass = new MockClass(mockProjectContent, "System.Console");
mockProjectContent.ClassToReturnFromGetClass = systemConsoleClass;
@ -106,7 +107,7 @@ namespace PythonBinding.Tests.Resolver @@ -106,7 +107,7 @@ namespace PythonBinding.Tests.Resolver
protected virtual ICompilationUnit CreateCompilationUnit(IProjectContent projectContent)
{
ICompilationUnit compilationUnit = new DefaultCompilationUnit(projectContent);
testClass = new MockClass(compilationUnit, "Test");
testClass = new MockClass(projectContent, "Test");
compilationUnit.Classes.Add(testClass);
return compilationUnit;
}

1
src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemNamespaceWithMissingImportTestFixture.cs

@ -11,6 +11,7 @@ using ICSharpCode.PythonBinding; @@ -11,6 +11,7 @@ using ICSharpCode.PythonBinding;
using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Resolver
{

1
src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportTextBoxTestFixture.cs

@ -13,6 +13,7 @@ using ICSharpCode.SharpDevelop.Dom; @@ -13,6 +13,7 @@ using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.CSharp;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Resolver
{

1
src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportedAsMyTextBoxTestFixture.cs

@ -13,6 +13,7 @@ using ICSharpCode.SharpDevelop.Dom; @@ -13,6 +13,7 @@ using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.CSharp;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Resolver
{

52
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/CreatePythonTestRunnerTestFixture.cs

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.Core;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
namespace PythonBinding.Tests.Testing
{
[TestFixture]
public class CreatePythonTestRunnerTestFixture
{
PythonTestFramework testFramework;
[TestFixtureSetUp]
public void SetUpFixture()
{
if (!PropertyService.Initialized) {
PropertyService.InitializeService(String.Empty, String.Empty, String.Empty);
}
}
[SetUp]
public void Init()
{
testFramework = new PythonTestFramework();
}
[Test]
public void PythonTestFrameworkCreateTestRunnerReturnsPythonTestRunner()
{
Assert.IsInstanceOf(typeof(PythonTestRunner), testFramework.CreateTestRunner());
}
[Test]
public void PythonTestFrameworkCreateTestDebuggerReturnsPythonTestDebugger()
{
Assert.IsInstanceOf(typeof(PythonTestDebugger), testFramework.CreateTestDebugger());
}
[Test]
public void PythonTestFrameworkIsBuildNeededBeforeTestRunReturnsFalse()
{
Assert.IsFalse(testFramework.IsBuildNeededBeforeTestRun);
}
}
}

41
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/CreateTextWriterFromCreateTextWriterInfoTestFixture.cs

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Text;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
namespace PythonBinding.Tests.Testing
{
[TestFixture]
public class CreateTextWriterFromCreateTextWriterInfoTestFixture
{
TextWriter textWriter;
[TestFixtureSetUp]
public void SetUpFixture()
{
string fileName = Path.GetTempFileName();
CreateTextWriterInfo info = new CreateTextWriterInfo(fileName, Encoding.UTF8, false);
textWriter = info.CreateTextWriter();
}
[TestFixtureTearDown]
public void TearDownFixture()
{
textWriter.Dispose();
}
[Test]
public void CreatedTextWriterEncodingIsUtf8()
{
Assert.AreEqual(Encoding.UTF8, textWriter.Encoding);
}
}
}

57
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/CreateTextWriterInfoEqualsTestFixture.cs

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Text;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
namespace PythonBinding.Tests.Testing
{
[TestFixture]
public class CreateTextWriterInfoEqualsTestFixture
{
[Test]
public void CreateTextWriterInfosAreEqualWhenFileNameAndEncodingAndAppendAreEqual()
{
CreateTextWriterInfo lhs = new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
CreateTextWriterInfo rhs = new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
Assert.AreEqual(lhs, rhs);
}
[Test]
public void CreateTextWriterInfosAreNotEqualWhenFileNamesAreDifferent()
{
CreateTextWriterInfo lhs = new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
CreateTextWriterInfo rhs = new CreateTextWriterInfo("different-filename.txt", Encoding.UTF8, true);
Assert.AreNotEqual(lhs, rhs);
}
[Test]
public void CreateTextWriterInfosAreNotEqualWhenEncodingsAreDifferent()
{
CreateTextWriterInfo lhs = new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
CreateTextWriterInfo rhs = new CreateTextWriterInfo("test.txt", Encoding.ASCII, true);
Assert.AreNotEqual(lhs, rhs);
}
[Test]
public void CreateTextWriterInfosAreNotEqualWhenAppendIsDifferent()
{
CreateTextWriterInfo lhs = new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
CreateTextWriterInfo rhs = new CreateTextWriterInfo("test.txt", Encoding.UTF8, false);
Assert.AreNotEqual(lhs, rhs);
}
[Test]
public void CreateTextWriterInfoEqualsReturnsFalseWhenNullPassedAsParameter()
{
CreateTextWriterInfo lhs = new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
Assert.IsFalse(lhs.Equals(null));
}
}
}

95
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonConsoleApplicationTestFixture.cs

@ -0,0 +1,95 @@ @@ -0,0 +1,95 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Diagnostics;
using ICSharpCode.Core;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests.Testing
{
[TestFixture]
public class PythonConsoleApplicationTestFixture
{
PythonConsoleApplication app;
AddInOptions options;
[SetUp]
public void Init()
{
options = new AddInOptions(new Properties());
options.PythonFileName = @"C:\IronPython\ipy.exe";
app = new PythonConsoleApplication(options);
}
[Test]
public void FileNameIsPythonFileNameFromAddInOptions()
{
string expectedFileName = @"C:\IronPython\ipy.exe";
Assert.AreEqual(expectedFileName, app.FileName);
}
[Test]
public void GetArgumentsReturnsDebugOptionWhenDebugIsTrue()
{
app.Debug = true;
string expectedCommandLine = "-X:Debug";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
}
[Test]
public void GetArgumentsReturnsQuotedPythonScriptFileName()
{
app.PythonScriptFileName = @"d:\projects\my ipy\test.py";
string expectedCommandLine = "\"d:\\projects\\my ipy\\test.py\"";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
}
[Test]
public void GetArgumentsReturnsQuotedPythonScriptFileNameAndItsCommandLineArguments()
{
app.Debug = true;
app.PythonScriptFileName = @"d:\projects\my ipy\test.py";
app.PythonScriptCommandLineArguments = "@responseFile.txt -def";
string expectedCommandLine =
"-X:Debug \"d:\\projects\\my ipy\\test.py\" @responseFile.txt -def";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
}
[Test]
public void GetProcessStartInfoHasFileNameThatEqualsIronPythonConsoleApplicationExeFileName()
{
ProcessStartInfo startInfo = app.GetProcessStartInfo();
string expectedFileName = @"C:\IronPython\ipy.exe";
Assert.AreEqual(expectedFileName, startInfo.FileName);
}
[Test]
public void GetProcessStartInfoHasDebugFlagSetInArguments()
{
app.Debug = true;
ProcessStartInfo startInfo = app.GetProcessStartInfo();
string expectedCommandLine = "-X:Debug";
Assert.AreEqual(expectedCommandLine, startInfo.Arguments);
}
[Test]
public void GetProcessStartInfoHasWorkingDirectoryIfSet()
{
app.WorkingDirectory = @"d:\temp";
ProcessStartInfo startInfo = app.GetProcessStartInfo();
Assert.AreEqual(@"d:\temp", startInfo.WorkingDirectory);
}
}
}

82
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonStandardLibraryPathTests.cs

@ -0,0 +1,82 @@ @@ -0,0 +1,82 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
namespace PythonBinding.Tests.Testing
{
[TestFixture]
public class PythonStandardLibraryPathTests
{
[Test]
public void PathsPropertyReturnsPython26LibDirectory()
{
PythonStandardLibraryPath path = new PythonStandardLibraryPath(@"c:\python26\lib");
string[] expectedPaths = new string[] { @"c:\python26\lib" };
Assert.AreEqual(expectedPaths, path.Directories);
}
[Test]
public void HasPathReturnsTrueForNonEmptyPathString()
{
PythonStandardLibraryPath path = new PythonStandardLibraryPath(@"c:\python26\lib");
Assert.IsTrue(path.HasPath);
}
[Test]
public void HasPathReturnsFalseForEmptyPathString()
{
PythonStandardLibraryPath path = new PythonStandardLibraryPath(String.Empty);
Assert.IsFalse(path.HasPath);
}
[Test]
public void DirectoryPropertyReturnsPython26LibDirectoryAndPython26LibTkDirectory()
{
PythonStandardLibraryPath path = new PythonStandardLibraryPath(@"c:\python26\lib;c:\python26\lib\lib-tk");
string[] expectedPaths = new string[] { @"c:\python26\lib", @"c:\python26\lib\lib-tk" };
Assert.AreEqual(expectedPaths, path.Directories);
}
[Test]
public void DirectoryPropertyReturnsPython26LibDirectoryAndPython26LibTkDirectorySetInPathProperty()
{
PythonStandardLibraryPath path = new PythonStandardLibraryPath(String.Empty);
path.Path = @"c:\python26\lib;c:\python26\lib\lib-tk";
string[] expectedPaths = new string[] { @"c:\python26\lib", @"c:\python26\lib\lib-tk" };
Assert.AreEqual(expectedPaths, path.Directories);
}
[Test]
public void DirectoriesAreClearedWhenPathIsSetToDifferentValue()
{
PythonStandardLibraryPath path = new PythonStandardLibraryPath(@"c:\temp");
path.Path = @"c:\python26\lib;c:\python26\lib\lib-tk";
string[] expectedPaths = new string[] { @"c:\python26\lib", @"c:\python26\lib\lib-tk" };
Assert.AreEqual(expectedPaths, path.Directories);
}
[Test]
public void EmptyDirectoryInPathNotAddedToDirectories()
{
PythonStandardLibraryPath path = new PythonStandardLibraryPath(@"c:\temp;;c:\python\lib");
string[] expectedPaths = new string[] { @"c:\temp", @"c:\python\lib" };
Assert.AreEqual(expectedPaths, path.Directories);
}
[Test]
public void DirectoryWithJustWhitespaceIsNotAddedToPath()
{
PythonStandardLibraryPath path = new PythonStandardLibraryPath(@"c:\temp; ;c:\python\lib");
string[] expectedPaths = new string[] { @"c:\temp", @"c:\python\lib" };
Assert.AreEqual(expectedPaths, path.Directories);
}
}
}

156
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestDebuggerRunsSelectedTestMethodTestFixture.cs

@ -0,0 +1,156 @@ @@ -0,0 +1,156 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using ICSharpCode.Core;
using ICSharpCode.PythonBinding;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.UnitTesting;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Testing
{
[TestFixture]
public class PythonTestDebuggerRunsSelectedTestMethodTestFixture
{
MockDebuggerService debuggerService;
UnitTesting.Tests.Utils.MockDebugger debugger;
MockMessageService messageService;
MockCSharpProject project;
PythonTestDebugger testDebugger;
MockTestResultsMonitor testResultsMonitor;
SelectedTests selectedTests;
MockMethod methodToTest;
AddInOptions options;
MockPythonFileService fileService;
StringBuilder responseFileText;
StringWriter responseFileStringWriter;
PythonStandardLibraryPath standardLibraryPath;
[SetUp]
public void Init()
{
CreateTestDebugger();
CreateTestMethod();
}
void CreateTestDebugger()
{
debuggerService = new MockDebuggerService();
debugger = debuggerService.MockDebugger;
messageService = new MockMessageService();
testResultsMonitor = new MockTestResultsMonitor();
options = new AddInOptions(new Properties());
options.PythonFileName = @"c:\ironpython\ipy.exe";
standardLibraryPath = new PythonStandardLibraryPath(@"c:\python\lib");
fileService = new MockPythonFileService();
testDebugger = new PythonTestDebugger(debuggerService, messageService, testResultsMonitor, options, standardLibraryPath, fileService);
}
void CreateTestMethod()
{
project = new MockCSharpProject();
MockClass c = new MockClass("MyNamespace.MyTestClass");
methodToTest = new MockMethod(c, "MyTestMethod");
}
void RunTestsOnSelectedTestMethod()
{
fileService.SetTempFileName(@"d:\temp\tmp66.tmp");
CreateTemporaryResponseFileWriter();
selectedTests = new SelectedTests(project, null, null, methodToTest);
testDebugger.Start(selectedTests);
}
void CreateTemporaryResponseFileWriter()
{
responseFileText = new StringBuilder();
responseFileStringWriter = new StringWriter(responseFileText);
fileService.SetTextWriter(responseFileStringWriter);
}
[Test]
public void TestDebuggerProcessFileNameIsIronPythonConsoleExeTakenFromAddInOptions()
{
RunTestsOnSelectedTestMethod();
string expectedFileName = @"c:\ironpython\ipy.exe";
Assert.AreEqual(expectedFileName, debugger.ProcessStartInfo.FileName);
}
[Test]
public void DisposingTestRunnerDeletesTemporaryResponseFile()
{
fileService.FileNameDeleted = null;
RunTestsOnSelectedTestMethod();
testDebugger.Dispose();
string expectedFileName = @"d:\temp\tmp66.tmp";
Assert.AreEqual(expectedFileName, fileService.FileNameDeleted);
}
[Test]
public void DisposingTestRunnerDisposesTestResultsMonitor()
{
RunTestsOnSelectedTestMethod();
testDebugger.Dispose();
Assert.IsTrue(testResultsMonitor.IsDisposeMethodCalled);
}
[Test]
public void CommandLineArgumentHasSharpDevelopTestPythonScriptAndResponseFileName()
{
AddIn addin = AddInPathHelper.CreateDummyPythonAddInInsideAddInTree();
addin.FileName = @"c:\sharpdevelop\addins\pythonbinding\pythonbinding.addin";
RunTestsOnSelectedTestMethod();
string expectedCommandLine =
"-X:Debug " +
"\"c:\\sharpdevelop\\addins\\pythonbinding\\TestRunner\\sdtest.py\" " +
"\"@d:\\temp\\tmp66.tmp\"";
Assert.AreEqual(expectedCommandLine, debugger.ProcessStartInfo.Arguments);
}
[Test]
public void PythonTestResultReturnedFromTestFinishedEvent()
{
TestResult testResult = null;
testDebugger.TestFinished += delegate(object source, TestFinishedEventArgs e) {
testResult = e.Result;
};
TestResult testResultToFire = new TestResult("test");
testResultsMonitor.FireTestFinishedEvent(testResultToFire);
Assert.IsInstanceOf(typeof(PythonTestResult), testResult);
}
[Test]
public void ResponseFileTextContainsPythonLibraryPathFromPythonStandardLibraryPathObjectIfNotDefinedInAddInOptions()
{
standardLibraryPath.Path = @"c:\python\lib;c:\python\lib\lib-tk";
options.PythonLibraryPath = String.Empty;
testResultsMonitor.FileName = @"c:\temp\test-results.txt";
RunTestsOnSelectedTestMethod();
string expectedText =
"/p:\"c:\\python\\lib\"\r\n" +
"/p:\"c:\\python\\lib\\lib-tk\"\r\n" +
"/r:\"c:\\temp\\test-results.txt\"\r\n" +
"MyNamespace.MyTestClass.MyTestMethod\r\n";
Assert.AreEqual(expectedText, responseFileText.ToString());
}
}
}

75
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestClassTests.cs

@ -0,0 +1,75 @@ @@ -0,0 +1,75 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.PythonBinding;
using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Testing
{
[TestFixture]
public class PythonTestFrameworkIsTestClassTests
{
PythonTestFramework testFramework;
[SetUp]
public void Init()
{
testFramework = new PythonTestFramework();
}
[Test]
public void CreateClassWithUnitTestTestCaseBaseTypeReturnsClassWithFirstBaseTypeEqualToTestCase()
{
IClass c = MockClass.CreateClassWithBaseType("unittest.TestCase");
string name = c.BaseTypes[0].FullyQualifiedName;
string expectedName = "unittest.TestCase";
Assert.AreEqual(expectedName, name);
}
[Test]
public void IsTestClassReturnsTrueWhenClassFirstBaseTypeIsUnitTestTestCase()
{
MockClass c = MockClass.CreateClassWithBaseType("unittest.TestCase");
Assert.IsTrue(testFramework.IsTestClass(c));
}
[Test]
public void IsTestClassReturnsFalseWhenClassHasNoBaseTypes()
{
MockClass c = MockClass.CreateMockClassWithoutAnyAttributes();
Assert.IsFalse(testFramework.IsTestClass(c));
}
[Test]
public void IsTestClassReturnsFalseForNull()
{
Assert.IsFalse(testFramework.IsTestClass(null));
}
[Test]
public void IsTestClassReturnsFalseWhenFirstBaseTypeIsSystemWindowsFormsForm()
{
MockClass c = MockClass.CreateClassWithBaseType("System.Windows.Forms.Form");
Assert.IsFalse(testFramework.IsTestClass(c));
}
[Test]
public void IsTestClassReturnsTrueWhenDerivedClassHasBaseClassDerivedFromTestCase()
{
MockClass baseClass = MockClass.CreateClassWithBaseType("unittest.TestCase");
MockClass c = MockClass.CreateMockClassWithoutAnyAttributes();
DefaultReturnType returnType = new DefaultReturnType(baseClass);
c.BaseTypes.Add(returnType);
Assert.IsTrue(testFramework.IsTestClass(c));
}
}
}

49
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestMethodTests.cs

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Testing
{
[TestFixture]
public class PythonTestFrameworkIsTestMethodTests
{
PythonTestFramework testFramework;
[SetUp]
public void Init()
{
testFramework = new PythonTestFramework();
}
[Test]
public void IsTestMethodReturnsTrueForMethodThatStartsWithTest()
{
MockClass c = MockClass.CreateMockClassWithoutAnyAttributes();
MockMethod method = new MockMethod(c, "testRunThis");
Assert.IsTrue(testFramework.IsTestMethod(method));
}
[Test]
public void IsTestMethodReturnsFalseForNull()
{
Assert.IsFalse(testFramework.IsTestMethod(null));
}
[Test]
public void IsTestMethodReturnsFalseForMethodThatDoesNotStartWithTest()
{
MockClass c = MockClass.CreateMockClassWithoutAnyAttributes();
MockMethod method = new MockMethod(c, "RunThis");
Assert.IsFalse(testFramework.IsTestMethod(method));
}
}
}

66
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestProjectTests.cs

@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.PythonBinding;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Project;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Testing
{
[TestFixture]
public class PythonTestFrameworkIsTestProjectTests
{
PythonTestFramework testFramework;
[TestFixtureSetUp]
public void SetUpFixture()
{
MSBuildEngineHelper.InitMSBuildEngine();
}
[SetUp]
public void Init()
{
testFramework = new PythonTestFramework();
}
[Test]
public void IsTestProjectReturnsFalseForNull()
{
Assert.IsFalse(testFramework.IsTestProject(null));
}
[Test]
public void IsTestProjectReturnsTrueForPythonProject()
{
ProjectCreateInformation createInfo = new ProjectCreateInformation();
createInfo.Solution = new Solution();
createInfo.OutputProjectFileName = @"C:\projects\test.pyproj";
PythonProject project = new PythonProject(createInfo);
Assert.IsTrue(testFramework.IsTestProject(project));
}
[Test]
public void IsTestProjectReturnsFalseForNonPythonProject()
{
MockProject project = new MockProject();
Assert.IsFalse(testFramework.IsTestProject(project));
}
[Test]
public void IsTestProjectReturnsFalseForNullPythonProject()
{
PythonProject project = null;
Assert.IsFalse(testFramework.IsTestProject(project));
}
}
}

90
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestResultFailureTestFixture.cs

@ -0,0 +1,90 @@ @@ -0,0 +1,90 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.PythonBinding;
using ICSharpCode.UnitTesting;
using NUnit.Framework;
namespace PythonBinding.Tests.Testing
{
[TestFixture]
public class PythonTestResultFailureTestFixture
{
PythonTestResult pythonTestResult;
string stackTraceText;
[SetUp]
public void Init()
{
TestResult testResult = new TestResult("MyTest");
testResult.ResultType = TestResultType.Failure;
testResult.Message = "test failed";
stackTraceText =
"Traceback (most recent call last):\r\n" +
" File \"d:\\temp\\test\\PyTests\\Tests\\MyClassTest.py\", line 16, in testAssertEquals\r\n" +
" self.assertEqual(10, 15, 'wrong size after resize')\r\n" +
"AssertionError: wrong size after resize";
testResult.StackTrace = stackTraceText;
pythonTestResult = new PythonTestResult(testResult);
}
[Test]
public void TestResultNameIsMyTest()
{
Assert.AreEqual("MyTest", pythonTestResult.Name);
}
[Test]
public void TestResultTypeIsFailure()
{
Assert.AreEqual(TestResultType.Failure, pythonTestResult.ResultType);
}
[Test]
public void TestResultMessageIsTestFailed()
{
Assert.AreEqual("test failed", pythonTestResult.Message);
}
[Test]
public void PythonTestResultHasStackTraceFromOriginalTestResult()
{
Assert.AreEqual(stackTraceText, pythonTestResult.StackTrace);
}
[Test]
public void StackTraceFilePositionHasExpectedFileName()
{
string expectedFileName = "d:\\temp\\test\\PyTests\\Tests\\MyClassTest.py";
Assert.AreEqual(expectedFileName, pythonTestResult.StackTraceFilePosition.FileName);
}
[Test]
public void StackTraceFilePositionLineIs16()
{
Assert.AreEqual(16, pythonTestResult.StackTraceFilePosition.Line);
}
[Test]
public void StackTraceFilePositionColumnIsOne()
{
Assert.AreEqual(1, pythonTestResult.StackTraceFilePosition.Column);
}
[Test]
public void ChangingStackTraceToEmptyStringSetsStackTraceFilePositionToEmpty()
{
pythonTestResult.StackTraceFilePosition = new FilePosition("test.cs", 10, 2);
pythonTestResult.StackTrace = String.Empty;
Assert.IsTrue(pythonTestResult.StackTraceFilePosition.IsEmpty);
}
}
}

44
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestResultStackTraceLineNumberOverflowTestFixture.cs

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.PythonBinding;
using ICSharpCode.UnitTesting;
using NUnit.Framework;
namespace PythonBinding.Tests.Testing
{
[TestFixture]
public class PythonTestResultLineNumberOverflowTestFixture
{
PythonTestResult pythonTestResult;
string stackTraceText;
[SetUp]
public void Init()
{
TestResult testResult = new TestResult("MyTest");
testResult.ResultType = TestResultType.Failure;
testResult.Message = "test failed";
stackTraceText =
"Traceback (most recent call last):\r\n" +
" File \"d:\\temp\\test\\PyTests\\Tests\\MyClassTest.py\", line 4294967296, in testAssertEquals\r\n" +
" self.assertEqual(10, 15, 'wrong size after resize')\r\n" +
"AssertionError: wrong size after resize";
testResult.StackTrace = stackTraceText;
pythonTestResult = new PythonTestResult(testResult);
}
[Test]
public void StackTraceFilePositionIsEmpty()
{
Assert.IsTrue(pythonTestResult.StackTraceFilePosition.IsEmpty);
}
}
}

206
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerResponseFileTestFixture.cs

@ -0,0 +1,206 @@ @@ -0,0 +1,206 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Text;
using ICSharpCode.Core.Services;
using ICSharpCode.PythonBinding;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.UnitTesting;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Testing
{
[TestFixture]
public class PythonTestRunnerResponseFileTestFixture
{
PythonTestRunnerResponseFile responseFile;
StringBuilder responseFileText;
StringWriter writer;
[SetUp]
public void Init()
{
responseFileText = new StringBuilder();
writer = new StringWriter(responseFileText);
responseFile = new PythonTestRunnerResponseFile(writer);
}
[Test]
public void WriteTestAddsTestNameToResponseFile()
{
responseFile.WriteTest("MyTests");
Assert.AreEqual("MyTests\r\n", responseFileText.ToString());
}
[Test]
public void WritePathAddsQuotedSysPathCommandLineArgument()
{
responseFile.WritePath(@"c:\mytests");
string expectedText = "/p:\"c:\\mytests\"\r\n";
Assert.AreEqual(expectedText, responseFileText.ToString());
}
[Test]
public void WriteResultsFileNameAddsQuotedResultsFileNameCommandLineArgument()
{
responseFile.WriteResultsFileName(@"c:\temp\tmp66.tmp");
string expectedText = "/r:\"c:\\temp\\tmp66.tmp\"\r\n";
Assert.AreEqual(expectedText, responseFileText.ToString());
}
[Test]
public void DisposeMethodDisposesTextWriterPassedInConstructor()
{
responseFile.Dispose();
Assert.Throws<ObjectDisposedException>(delegate { writer.Write("test"); });
}
[Test]
public void WriteTestsWritesSelectedTestMethodNameWhenMethodSelected()
{
MockMethod method = MockMethod.CreateMockMethodWithoutAnyAttributes();
method.FullyQualifiedName = "MyNamespace.MyTests.MyTestMethod";
SelectedTests tests = new SelectedTests(new MockCSharpProject(), null, null, method);
responseFile.WriteTests(tests);
string expectedText = "MyNamespace.MyTests.MyTestMethod\r\n";
Assert.AreEqual(expectedText, responseFileText.ToString());
}
[Test]
public void WriteTestsWritesSelectedTestClassNameWhenOnlyClassSelected()
{
MockClass c = MockClass.CreateMockClassWithoutAnyAttributes();
c.FullyQualifiedName = "MyNamespace.MyTests";
SelectedTests tests = new SelectedTests(new MockCSharpProject(), null, c, null);
responseFile.WriteTests(tests);
string expectedText = "MyNamespace.MyTests\r\n";
Assert.AreEqual(expectedText, responseFileText.ToString());
}
[Test]
public void WriteTestsWritesSelectedTestNamespaceWhenOnlyNamespaceSelected()
{
SelectedTests tests = new SelectedTests(new MockCSharpProject(), "MyNamespace", null, null);
responseFile.WriteTests(tests);
string expectedText = "MyNamespace\r\n";
Assert.AreEqual(expectedText, responseFileText.ToString());
}
[Test]
public void WriteTestsWritesNamespacesForAllFilesInProjectWhenOnlyProjectSelected()
{
MockCSharpProject project = new MockCSharpProject();
FileProjectItem item = new FileProjectItem(project, ItemType.Compile);
item.FileName = @"c:\projects\mytests\nonTestClass.py";
ProjectService.AddProjectItem(project, item);
item = new FileProjectItem(project, ItemType.Compile);
item.FileName = @"c:\projects\mytests\TestClass.py";
ProjectService.AddProjectItem(project, item);
SelectedTests tests = new SelectedTests(project);
responseFile.WriteTests(tests);
string expectedText =
"nonTestClass\r\n" +
"TestClass\r\n";
Assert.AreEqual(expectedText, responseFileText.ToString());
}
[Test]
public void WriteTestsWritesNothingToResponseFileWhenMethodAndClassAndNamespaceAndProjectIsNull()
{
SelectedTests tests = new SelectedTests(null);
responseFile.WriteTests(tests);
Assert.AreEqual(String.Empty, responseFileText.ToString());
}
[Test]
public void WriteTestsDoesNotThrowNullReferenceExceptionWhenNonFileProjectItemInProject()
{
MockCSharpProject project = new MockCSharpProject();
WebReferenceUrl webRef = new WebReferenceUrl(project);
webRef.Include = "test";
ProjectService.AddProjectItem(project, webRef);
FileProjectItem item = new FileProjectItem(project, ItemType.Compile);
item.FileName = @"c:\projects\mytests\myTests.py";
ProjectService.AddProjectItem(project, item);
SelectedTests tests = new SelectedTests(project);
responseFile.WriteTests(tests);
string expectedText = "myTests\r\n";
Assert.AreEqual(expectedText, responseFileText.ToString());
}
[Test]
public void WriteTestsWritesDirectoriesForReferencedProjectsToSysPathCommandLineArguments()
{
// Have to initialize the workbench since ProjectReferenceProjectItem has a dependency on
// WorkbenchSingleton.
InitializeWorkbench();
MockCSharpProject referencedProject = new MockCSharpProject();
referencedProject.FileName = @"c:\projects\pyproject\pyproject.pyproj";
MockCSharpProject unitTestProject = new MockCSharpProject();
ProjectReferenceProjectItem projectRef = new ProjectReferenceProjectItem(unitTestProject, referencedProject);
projectRef.FileName = @"c:\projects\pyproject\pyproject.pyproj";
ProjectService.AddProjectItem(unitTestProject, projectRef);
MockMethod method = MockMethod.CreateMockMethodWithoutAnyAttributes();
method.FullyQualifiedName = "MyNamespace.MyTests.MyTestMethod";
SelectedTests tests = new SelectedTests(unitTestProject, null, null, method);
responseFile.WriteTests(tests);
string expectedText =
"/p:\"c:\\projects\\pyproject\"\r\n" +
"MyNamespace.MyTests.MyTestMethod\r\n";
Assert.AreEqual(expectedText, responseFileText.ToString());
}
void InitializeWorkbench()
{
string addInXml =
"<AddIn name=\"Test\" author= \"\" copyright=\"\" description=\"\">\r\n" +
"<Manifest>\r\n" +
" <Identity name=\"Test\"/>\r\n" +
"</Manifest>\r\n" +
"<Path name=\"/SharpDevelop/Workbench/DisplayBindings\"/>\r\n " +
"</AddIn>";
AddIn addin = AddIn.Load(new StringReader(addInXml));
addin.Enabled = true;
AddInTree.InsertAddIn(addin);
if (!PropertyService.Initialized) {
PropertyService.InitializeService(String.Empty, String.Empty, String.Empty);
}
DummyServiceManager serviceManager = new DummyServiceManager();
ServiceManager.Instance = serviceManager;
WorkbenchSingleton.InitializeWorkbench(new MockWorkbench(), null);
}
}
}

225
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerRunsSelectedTestMethodTestFixture.cs

@ -0,0 +1,225 @@ @@ -0,0 +1,225 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using ICSharpCode.Core;
using ICSharpCode.PythonBinding;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.UnitTesting;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Testing
{
[TestFixture]
public class PythonTestRunnerRunsSelectedTestMethodTestFixture
{
MockCSharpProject project;
PythonTestRunner testRunner;
MockProcessRunner processRunner;
MockTestResultsMonitor testResultsMonitor;
SelectedTests selectedTests;
MockMethod methodToTest;
AddInOptions options;
MockPythonFileService fileService;
StringBuilder responseFileText;
StringWriter responseFileStringWriter;
PythonStandardLibraryPath standardLibraryPath;
[SetUp]
public void Init()
{
CreateTestRunner();
CreateTestMethod();
}
void CreateTestRunner()
{
processRunner = new MockProcessRunner();
testResultsMonitor = new MockTestResultsMonitor();
options = new AddInOptions(new Properties());
options.PythonFileName = @"c:\ironpython\ipy.exe";
fileService = new MockPythonFileService();
standardLibraryPath = new PythonStandardLibraryPath(@"c:\python\lib");
testRunner = new PythonTestRunner(processRunner, testResultsMonitor, options, standardLibraryPath, fileService);
}
void CreateTestMethod()
{
project = new MockCSharpProject();
MockClass c = new MockClass("MyNamespace.MyTestClass");
methodToTest = new MockMethod(c, "MyTestMethod");
}
void RunTestsOnSelectedTestMethod()
{
fileService.SetTempFileName(@"d:\temp\tmp66.tmp");
CreateTemporaryResponseFileWriter();
selectedTests = new SelectedTests(project, null, null, methodToTest);
testRunner.Start(selectedTests);
}
void CreateTemporaryResponseFileWriter()
{
responseFileText = new StringBuilder();
responseFileStringWriter = new StringWriter(responseFileText);
fileService.SetTextWriter(responseFileStringWriter);
}
[Test]
public void TestRunnerProcessFileNameIsIronPythonConsoleExeTakenFromAddInOptions()
{
RunTestsOnSelectedTestMethod();
string expectedFileName = @"c:\ironpython\ipy.exe";
Assert.AreEqual(expectedFileName, processRunner.CommandPassedToStartMethod);
}
[Test]
public void CommandLineArgumentHasSharpDevelopTestPythonScriptAndResponseFileName()
{
AddIn addin = AddInPathHelper.CreateDummyPythonAddInInsideAddInTree();
addin.FileName = @"c:\sharpdevelop\addins\pythonbinding\pythonbinding.addin";
RunTestsOnSelectedTestMethod();
string expectedCommandLine =
"\"c:\\sharpdevelop\\addins\\pythonbinding\\TestRunner\\sdtest.py\" " +
"\"@d:\\temp\\tmp66.tmp\"";
Assert.AreEqual(expectedCommandLine, processRunner.CommandArgumentsPassedToStartMethod);
}
[Test]
public void ResponseFileCreatedUsingTempFileName()
{
RunTestsOnSelectedTestMethod();
Assert.AreEqual(@"d:\temp\tmp66.tmp", fileService.CreateTextWriterInfoPassedToCreateTextWriter.FileName);
}
[Test]
public void ResponseFileCreatedWithUtf8Encoding()
{
RunTestsOnSelectedTestMethod();
Assert.AreEqual(Encoding.UTF8, fileService.CreateTextWriterInfoPassedToCreateTextWriter.Encoding);
}
[Test]
public void ResponseFileCreatedWithAppendSetToFalse()
{
RunTestsOnSelectedTestMethod();
Assert.IsFalse(fileService.CreateTextWriterInfoPassedToCreateTextWriter.Append);
}
[Test]
public void DisposingTestRunnerDeletesTemporaryResponseFile()
{
fileService.FileNameDeleted = null;
RunTestsOnSelectedTestMethod();
testRunner.Dispose();
string expectedFileName = @"d:\temp\tmp66.tmp";
Assert.AreEqual(expectedFileName, fileService.FileNameDeleted);
}
[Test]
public void DisposingTestRunnerDisposesTestResultsMonitor()
{
RunTestsOnSelectedTestMethod();
testRunner.Dispose();
Assert.IsTrue(testResultsMonitor.IsDisposeMethodCalled);
}
[Test]
public void ResponseFileTextContainsPythonLibraryPathAndTestResultsFileNameAndFullyQualifiedTestMethod()
{
standardLibraryPath.Path = String.Empty;
options.PythonLibraryPath = @"c:\python26\lib";
testResultsMonitor.FileName = @"c:\temp\test-results.txt";
RunTestsOnSelectedTestMethod();
string expectedText =
"/p:\"c:\\python26\\lib\"\r\n" +
"/r:\"c:\\temp\\test-results.txt\"\r\n" +
"MyNamespace.MyTestClass.MyTestMethod\r\n";
Assert.AreEqual(expectedText, responseFileText.ToString());
}
[Test]
public void ResponseFileTextDoesNotContainPythonLibraryPathIfItIsAnEmptyString()
{
options.PythonLibraryPath = String.Empty;
standardLibraryPath.Path = String.Empty;
testResultsMonitor.FileName = @"c:\temp\test-results.txt";
RunTestsOnSelectedTestMethod();
string expectedText =
"/r:\"c:\\temp\\test-results.txt\"\r\n" +
"MyNamespace.MyTestClass.MyTestMethod\r\n";
Assert.AreEqual(expectedText, responseFileText.ToString());
}
[Test]
public void ResponseFileTextContainsPythonLibraryPathFromPythonStandardLibraryPathObjectIfNotDefinedInAddInOptions()
{
standardLibraryPath.Path = @"c:\python\lib";
options.PythonLibraryPath = String.Empty;
testResultsMonitor.FileName = @"c:\temp\test-results.txt";
RunTestsOnSelectedTestMethod();
string expectedText =
"/p:\"c:\\python\\lib\"\r\n" +
"/r:\"c:\\temp\\test-results.txt\"\r\n" +
"MyNamespace.MyTestClass.MyTestMethod\r\n";
Assert.AreEqual(expectedText, responseFileText.ToString());
}
[Test]
public void ResponseFileTextWriterDisposedAfterTestsRun()
{
RunTestsOnSelectedTestMethod();
Assert.Throws<ObjectDisposedException>(delegate { responseFileStringWriter.Write("test"); });
}
[Test]
public void ProcessRunnerWorkingDirectoryIsDirectoryContainingProject()
{
RunTestsOnSelectedTestMethod();
string expectedDirectory = @"c:\projects\MyTests";
string actualDirectory = processRunner.WorkingDirectory;
Assert.AreEqual(expectedDirectory, actualDirectory);
}
[Test]
public void PythonTestResultReturnedFromTestFinishedEvent()
{
TestResult testResult = null;
testRunner.TestFinished += delegate(object source, TestFinishedEventArgs e) {
testResult = e.Result;
};
TestResult testResultToFire = new TestResult("test");
testResultsMonitor.FireTestFinishedEvent(testResultToFire);
Assert.IsInstanceOf(typeof(PythonTestResult), testResult);
}
}
}

60
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/AddInPathHelper.cs

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using ICSharpCode.Core;
namespace PythonBinding.Tests.Utils
{
public static class AddInPathHelper
{
public static AddIn CreateDummyPythonAddInInsideAddInTree()
{
RemoveOldAddIn();
AddIn addin = CreateAddIn();
AddInTree.InsertAddIn(addin);
return addin;
}
static void RemoveOldAddIn()
{
AddIn oldAddin = FindOldAddIn();
if (oldAddin != null) {
AddInTree.RemoveAddIn(oldAddin);
}
}
static AddIn FindOldAddIn()
{
foreach (AddIn addin in AddInTree.AddIns) {
if (addin.Manifest.PrimaryIdentity == "ICSharpCode.PythonBinding") {
return addin;
}
}
return null;
}
static AddIn CreateAddIn()
{
string xml = GetAddInXml();
AddIn addin = AddIn.Load(new StringReader(xml));
addin.FileName = @"C:\SharpDevelop\AddIns\PythonBinding\PythonBinding.addin";
return addin;
}
static string GetAddInXml()
{
return
"<AddIn name='PythonBinding' author= '' copyright='' description=''>\r\n" +
" <Manifest>\r\n" +
" <Identity name='ICSharpCode.PythonBinding'/>\r\n" +
" </Manifest>\r\n" +
"</AddIn>";
}
}
}

52
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedAddInOptions.cs

@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.Core;
using ICSharpCode.PythonBinding;
namespace PythonBinding.Tests.Utils
{
/// <summary>
/// Overrides the AddInOptions GetAddInPath method to return
/// some dummy data used for testing.
/// </summary>
public class DerivedAddInOptions : AddInOptions
{
string addInPath = String.Empty;
string addInPathRequested = String.Empty;
public DerivedAddInOptions(Properties properties) : base(properties)
{
}
/// <summary>
/// Gets the addin path string passed to the GetAddInPath method.
/// </summary>
public string AddInPathRequested {
get { return addInPathRequested; }
}
/// <summary>
/// Gets or sets the addin path that should be returned from the
/// GetAddInPath method.
/// </summary>
public string AddInPath {
get { return addInPath; }
set { addInPath = value; }
}
/// <summary>
/// Returns our dummy AddInPath.
/// </summary>
protected override string GetAddInPath(string addIn)
{
addInPathRequested = addIn;
return addInPath;
}
}
}

6
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonDesignerLoader.cs

@ -35,7 +35,6 @@ namespace PythonBinding.Tests.Utils @@ -35,7 +35,6 @@ namespace PythonBinding.Tests.Utils
protected override void OnEndLoad(bool successful, ICollection errors)
{
System.Console.WriteLine("DesignerLoader.OnEndLoad: successful: " + successful);
if (errors != null) {
foreach (object o in errors) {
Exception ex = o as Exception;
@ -49,22 +48,17 @@ namespace PythonBinding.Tests.Utils @@ -49,22 +48,17 @@ namespace PythonBinding.Tests.Utils
protected override void OnBeginLoad()
{
System.Console.WriteLine("DesignerLoader.OnBeginLoad");
base.OnBeginLoad();
}
protected override void Initialize()
{
System.Console.WriteLine("DesignerLoader.Initialize");
base.Initialize();
}
protected override void PerformLoad(IDesignerSerializationManager manager)
{
System.Console.WriteLine("DesignerLoader.PerformLoad Before");
base.PerformLoad(manager);
System.Console.WriteLine("DesignerLoader.PerformLoad After");
}
}
}

32
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DummyServiceManager.cs

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
using ICSharpCode.Core.Services;
using ICSharpCode.Core.WinForms;
namespace PythonBinding.Tests.Utils
{
public class DummyServiceManager : ServiceManager
{
WinFormsMessageService messageService = new WinFormsMessageService();
public DummyServiceManager()
{
}
public override IMessageService MessageService {
get { return messageService; }
}
public override object GetService(Type serviceType)
{
return null;
}
}
}

38
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DummySynchronizeInvoke.cs

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.ComponentModel;
namespace PythonBinding.Tests.Utils
{
public class DummySynchronizeInvoke : ISynchronizeInvoke
{
public DummySynchronizeInvoke()
{
}
public bool InvokeRequired {
get { return false; }
}
public IAsyncResult BeginInvoke(Delegate method, object[] args)
{
return null;
}
public object EndInvoke(IAsyncResult result)
{
return null;
}
public object Invoke(Delegate method, object[] args)
{
return null;
}
}
}

31
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockClass.cs

@ -1,31 +0,0 @@ @@ -1,31 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.Dom;
namespace PythonBinding.Tests.Utils
{
/// <summary>
/// Mock implementation of the IClass interface
/// </summary>
public class MockClass : DefaultClass
{
// derive from real DefaultClass. The resolver is free to access any information from the class,
// and I don't want to have to adjust the mock whenever something in SharpDevelop.Dom changes.
public MockClass(ICompilationUnit cu, string name)
: base(cu, name)
{
}
public MockClass(IProjectContent pc, string name)
: base(new DefaultCompilationUnit(pc), name)
{
}
}
}

6
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockDesignerLoaderHost.cs

@ -86,7 +86,6 @@ namespace PythonBinding.Tests.Utils @@ -86,7 +86,6 @@ namespace PythonBinding.Tests.Utils
public void EndLoad(string baseClassName, bool successful, ICollection errorCollection)
{
System.Console.WriteLine("DesignerLoaderHost.EndLoad");
}
public void Reload()
@ -133,13 +132,11 @@ namespace PythonBinding.Tests.Utils @@ -133,13 +132,11 @@ namespace PythonBinding.Tests.Utils
public Type GetType(string typeName)
{
System.Console.WriteLine("DesignerLoaderHost.GetType: " + typeName);
return typeResolutionService.GetType(typeName);
}
public void AddService(Type serviceType, object serviceInstance)
{
System.Console.WriteLine("DesignerLoaderHost.AddService: " + serviceType.Name + " IsNull: " + (serviceInstance == null));
serviceContainer.AddService(serviceType, serviceInstance);
}
@ -165,7 +162,6 @@ namespace PythonBinding.Tests.Utils @@ -165,7 +162,6 @@ namespace PythonBinding.Tests.Utils
public object GetService(Type serviceType)
{
System.Console.WriteLine("DesignerLoaderHost.GetService: " + serviceType.Name);
return serviceContainer.GetService(serviceType);
}
@ -203,7 +199,7 @@ namespace PythonBinding.Tests.Utils @@ -203,7 +199,7 @@ namespace PythonBinding.Tests.Utils
TransactionOpened(this, e);
}
}
protected virtual void OnTransactionOpening(EventArgs e)
{
if (TransactionOpening != null) {

297
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockMethod.cs

@ -1,297 +0,0 @@ @@ -1,297 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.Dom;
namespace PythonBinding.Tests.Utils
{
/// <summary>
/// Mock IMethod implementation.
/// </summary>
public class MockMethod : IMethod
{
public MockMethod()
{
}
public DomRegion BodyRegion { get; set; }
public IList<ITypeParameter> TypeParameters {
get {
throw new NotImplementedException();
}
}
public bool IsConstructor {
get {
throw new NotImplementedException();
}
}
public bool IsOperator {
get {
throw new NotImplementedException();
}
}
public IList<string> HandlesClauses {
get {
throw new NotImplementedException();
}
}
public IList<IParameter> Parameters {
get {
throw new NotImplementedException();
}
}
public bool IsExtensionMethod {
get {
throw new NotImplementedException();
}
}
public string FullyQualifiedName {
get {
throw new NotImplementedException();
}
}
public IReturnType DeclaringTypeReference {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public IMember GenericMember {
get {
throw new NotImplementedException();
}
}
public DomRegion Region {
get {
throw new NotImplementedException();
}
}
public string Name {
get {
throw new NotImplementedException();
}
}
public string Namespace {
get {
throw new NotImplementedException();
}
}
public string DotNetName {
get {
throw new NotImplementedException();
}
}
public IReturnType ReturnType {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public IList<ExplicitInterfaceImplementation> InterfaceImplementations {
get {
throw new NotImplementedException();
}
}
public IClass DeclaringType {
get {
throw new NotImplementedException();
}
}
public ModifierEnum Modifiers {
get {
throw new NotImplementedException();
}
}
public IList<IAttribute> Attributes {
get {
throw new NotImplementedException();
}
}
public string Documentation {
get {
throw new NotImplementedException();
}
}
public bool IsAbstract {
get {
throw new NotImplementedException();
}
}
public bool IsSealed {
get {
throw new NotImplementedException();
}
}
public bool IsStatic {
get {
throw new NotImplementedException();
}
}
public bool IsConst {
get {
throw new NotImplementedException();
}
}
public bool IsVirtual {
get {
throw new NotImplementedException();
}
}
public bool IsPublic {
get {
throw new NotImplementedException();
}
}
public bool IsProtected {
get {
throw new NotImplementedException();
}
}
public bool IsPrivate {
get {
throw new NotImplementedException();
}
}
public bool IsInternal {
get {
throw new NotImplementedException();
}
}
public bool IsReadonly {
get {
throw new NotImplementedException();
}
}
public bool IsProtectedAndInternal {
get {
throw new NotImplementedException();
}
}
public bool IsProtectedOrInternal {
get {
throw new NotImplementedException();
}
}
public bool IsOverride {
get {
throw new NotImplementedException();
}
}
public bool IsOverridable {
get {
throw new NotImplementedException();
}
}
public bool IsNew {
get {
throw new NotImplementedException();
}
}
public bool IsSynthetic {
get {
throw new NotImplementedException();
}
}
public object UserData {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public bool IsFrozen {
get {
throw new NotImplementedException();
}
}
public IMember CreateSpecializedMember()
{
throw new NotImplementedException();
}
public bool IsAccessible(IClass callingClass, bool isClassInInheritanceTree)
{
throw new NotImplementedException();
}
public void Freeze()
{
throw new NotImplementedException();
}
public int CompareTo(object obj)
{
throw new NotImplementedException();
}
public object Clone()
{
throw new NotImplementedException();
}
public ICompilationUnit CompilationUnit {
get {
throw new NotImplementedException();
}
}
public IProjectContent ProjectContent {
get {
throw new NotImplementedException();
}
}
public EntityType EntityType {
get { return EntityType.Method; }
}
}
}

58
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockPythonFileService.cs

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Text;
using ICSharpCode.PythonBinding;
namespace PythonBinding.Tests.Utils
{
public class MockPythonFileService : IPythonFileService
{
CreateTextWriterInfo createTextWriterInfoPassedToCreateTextWriter;
string tempFileName;
TextWriter textWriter;
string fileNameDeleted;
public void SetTempFileName(string fileName)
{
this.tempFileName = fileName;
}
public string GetTempFileName()
{
return tempFileName;
}
public void SetTextWriter(TextWriter writer)
{
this.textWriter = writer;
}
public TextWriter CreateTextWriter(CreateTextWriterInfo textWriterInfo)
{
createTextWriterInfoPassedToCreateTextWriter = textWriterInfo;
return textWriter;
}
public CreateTextWriterInfo CreateTextWriterInfoPassedToCreateTextWriter {
get { return createTextWriterInfoPassedToCreateTextWriter; }
set { createTextWriterInfoPassedToCreateTextWriter = value; }
}
public void DeleteFile(string fileName)
{
fileNameDeleted = fileName;
}
public string FileNameDeleted {
get { return fileNameDeleted; }
set { fileNameDeleted = value; }
}
}
}

1
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockTypeResolutionService.cs

@ -43,7 +43,6 @@ namespace PythonBinding.Tests.Utils @@ -43,7 +43,6 @@ namespace PythonBinding.Tests.Utils
public Type GetType(string name)
{
System.Console.WriteLine("TypeResolutionService.GetType: " + name);
lastTypeNameResolved = name;
if (name == "Form") {
return typeof(Form);

17
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockWorkbench.cs

@ -19,6 +19,9 @@ namespace PythonBinding.Tests.Utils @@ -19,6 +19,9 @@ namespace PythonBinding.Tests.Utils
/// </summary>
public class MockWorkbench : IWorkbench
{
DummySynchronizeInvoke synchronizeInvoke = new DummySynchronizeInvoke();
Form form = new Form();
public event EventHandler ActiveWorkbenchWindowChanged { add {} remove {} }
public event EventHandler ActiveViewContentChanged { add {} remove {} }
public event EventHandler ActiveContentChanged { add {} remove {} }
@ -26,11 +29,11 @@ namespace PythonBinding.Tests.Utils @@ -26,11 +29,11 @@ namespace PythonBinding.Tests.Utils
public event ViewContentEventHandler ViewClosed { add {} remove {} }
public IWin32Window MainWin32Window {
get { return null; }
get { return form; }
}
public System.ComponentModel.ISynchronizeInvoke SynchronizingObject {
get { return null; }
get { return synchronizeInvoke; }
}
public System.Windows.Window MainWindow {
@ -90,12 +93,8 @@ namespace PythonBinding.Tests.Utils @@ -90,12 +93,8 @@ namespace PythonBinding.Tests.Utils
}
public IWorkbenchLayout WorkbenchLayout {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
get { return null; }
set { }
}
public bool IsActiveWindow {
@ -106,7 +105,6 @@ namespace PythonBinding.Tests.Utils @@ -106,7 +105,6 @@ namespace PythonBinding.Tests.Utils
public void Initialize()
{
throw new NotImplementedException();
}
public void ShowView(IViewContent content)
@ -156,7 +154,6 @@ namespace PythonBinding.Tests.Utils @@ -156,7 +154,6 @@ namespace PythonBinding.Tests.Utils
public void SetMemento(Properties memento)
{
throw new NotImplementedException();
}
public bool FullScreen {

2
src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBindingAddInFile.cs → src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonBindingAddInFile.cs

@ -10,7 +10,7 @@ using System.IO; @@ -10,7 +10,7 @@ using System.IO;
using System.Reflection;
using System.Xml;
namespace PythonBinding.Tests
namespace PythonBinding.Tests.Utils
{
/// <summary>
/// Utility class that reads the PythonBinding.addin file

50
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/AddInPathHelperTestFixture.cs

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.Core;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests.Utils.Tests
{
[TestFixture]
public class AddInPathHelperTestFixture
{
AddIn pythonAddIn;
[SetUp]
public void Init()
{
pythonAddIn = AddInPathHelper.CreateDummyPythonAddInInsideAddInTree();
}
[Test]
public void AddInFileNameIsCDriveSharpDevelopAddInsPythonBindingPythonBindingAddIn()
{
string expectedFileName = @"C:\SharpDevelop\AddIns\PythonBinding\PythonBinding.addin";
Assert.AreEqual(expectedFileName, pythonAddIn.FileName);
}
[Test]
public void StringParserAddInPathIsCDriveSharpDevelopAddInsPythonBindingForPythonBindingAddIn()
{
string directory = StringParser.Parse("${addinpath:ICSharpCode.PythonBinding}");
string expectedDirectory = @"C:\SharpDevelop\AddIns\PythonBinding";
Assert.AreEqual(expectedDirectory, directory);
}
[Test]
public void ChangingAddInFileNameReturnsExpectedFileNameFromStringParserAddInPath()
{
pythonAddIn.FileName = @"c:\def\pythonbinding.addin";
string expectedDirectory = @"c:\def";
string actualDirectory = StringParser.Parse("${addinpath:ICSharpCode.PythonBinding}");
Assert.AreEqual(expectedDirectory, actualDirectory);
}
}
}

5
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/MockProjectContentTests.cs

@ -11,19 +11,20 @@ using ICSharpCode.PythonBinding; @@ -11,19 +11,20 @@ using ICSharpCode.PythonBinding;
using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
using UnitTesting.Tests.Utils;
namespace PythonBinding.Tests.Utils.Tests
{
[TestFixture]
public class MockProjectContentTests
{
MockProjectContent projectContent;
PythonBinding.Tests.Utils.MockProjectContent projectContent;
List<ICompletionEntry> items;
[SetUp]
public void Init()
{
projectContent = new MockProjectContent();
projectContent = new PythonBinding.Tests.Utils.MockProjectContent();
items = new List<ICompletionEntry>();
}

65
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/MockPythonFileServiceTestFixture.cs

@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Text;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
namespace PythonBinding.Tests.Utils.Tests
{
[TestFixture]
public class MockPythonFileServiceTestFixture
{
MockPythonFileService fileService;
[SetUp]
public void Init()
{
fileService = new MockPythonFileService();
}
[Test]
public void GetTempFileNameReturnsReturnsTemporaryFileName()
{
string expectedFileName = @"c:\temp\tmp1.tmp";
fileService.SetTempFileName(expectedFileName);
string tempFileName = fileService.GetTempFileName();
Assert.AreEqual(expectedFileName, tempFileName);
}
[Test]
public void TextWriterReturnedFromCreateTextWriter()
{
using (StringWriter stringWriter = new StringWriter(new StringBuilder())) {
fileService.SetTextWriter(stringWriter);
CreateTextWriterInfo info = new CreateTextWriterInfo(@"test.tmp", Encoding.UTF8, true);
Assert.AreEqual(stringWriter, fileService.CreateTextWriter(info));
}
}
[Test]
public void CreateTextWriterInfoIsSavedWhenCreateTextWriterMethodIsCalled()
{
fileService.CreateTextWriterInfoPassedToCreateTextWriter = null;
CreateTextWriterInfo info = new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
fileService.CreateTextWriter(info);
Assert.AreEqual(info, fileService.CreateTextWriterInfoPassedToCreateTextWriter);
}
[Test]
public void DeleteFileSavesFileNameDeleted()
{
fileService.FileNameDeleted = null;
string expectedFileName = @"c:\temp\tmp66.tmp";
fileService.DeleteFile(expectedFileName);
Assert.AreEqual(expectedFileName, fileService.FileNameDeleted);
}
}
}

316
src/Setup/Files.wxs

@ -10,72 +10,72 @@ @@ -10,72 +10,72 @@
<Component Id="SharpDevelopExe" Guid="F632C62C-A4DD-4507-9678-C7DCFF4DBC8C" DiskId="1">
<File Id="SharpDevelop.exe" Name="SharpDevelop.exe" Source="..\..\bin\SharpDevelop.exe" Assembly=".net" AssemblyApplication="SharpDevelop.exe" AssemblyManifest="SharpDevelop.exe" KeyPath="yes">
<!--
NGens SharpDevelop.exe. Needs the NetFx extension (WixNetFxExtension.dll),
library (netfx.wixlib) and custom actions (netfxca.dll).
Priority=0 means the image generation occurs during
setup. Other values defer the generation.
Default Platform value is 32bit which tries to generate images
for 32 bitversions of the .NET framework on the
target machine. This will fail on a machine with
64 bit version of .NET. Cannot use Platform=all
since this runs NGen for both 32 and 64 bit versions
regardless of whether they exist on the target
machine.
-->
NGens SharpDevelop.exe. Needs the NetFx extension (WixNetFxExtension.dll),
library (netfx.wixlib) and custom actions (netfxca.dll).
Priority=0 means the image generation occurs during
setup. Other values defer the generation.
Default Platform value is 32bit which tries to generate images
for 32 bitversions of the .NET framework on the
target machine. This will fail on a machine with
64 bit version of .NET. Cannot use Platform=all
since this runs NGen for both 32 and 64 bit versions
regardless of whether they exist on the target
machine.
-->
<!-- Using priority 1 because 0 slows down setup and might have a bug that causes it to work like priority 3 (http://www.mail-archive.com/wix-users@lists.sourceforge.net/msg34312.html). -->
<netfx:NativeImage Id="SharpDevelopNGenImage" Priority="1" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension" />
</File>
</Component>
<Component Id="BooProjectFileAssociation" Guid="8FD60FEE-9220-4409-B98E-273AAC4A03E0" DiskId="1">
<!--
Get several ICE33 warnings using the ProgId element
but these apparently can safely be ignored
according to a post on the wix-users list by
Rob Mencshing. Also using the ProgId element
does not create the ProgId table. The current installer
no longer uses the ProgId but instead uses Registry
keys instead. It still creates the same entries in the
msi.
http://sourceforge.net/mailarchive/message.php?msg_id=9075241
Note that the Target of the form [#FileId] expands out to the
full path of the file. A target of the form [!FileId]
expands to the short name of the file (i.e. it includes ~
characters). We need the full path otherwise the exe name
will be something like SharpDev~1.exe and the
SharpDevelop.exe.manifest file will not be found when
running the application so it does not use XP visual styles.
Unfortunately using [#FileId] generates lots of ICE69
warnings for the icon and the SharpDevelop.exe target
if they are in a different component.
Not sure why [!FileId] does not produce an error since
the problem seems to be similar, basically the registry
key generated by the ProgId element belongs to one
component whilst we are referencing another component
containing the SharpDevelop.exe and another
containing the icon.
http://msdn.microsoft.com/library/en-us/msi/setup/ice69.asp
The ICE69 errors can be ignored for now since the component
being referenced by the file associations will always be installed
even though it is in a different feature. If the FileTypeRegister
addin is an optional install then the ICE69 errors would need to
be resolved.
We are not using the ProgId element which sets up the
file association registry keys for us, but are specifying them
directly as registry keys. This allows us to use one of the keys
as a key path instead of having to use the parent component's
directory as the key path. The key path is what is used
by the installer to detect whether the component is installed.
Using the component's parent directory (i.e. the Bin folder)
is not feasible since the file associations may not be installed
if the user does not install them in the feature tree.
-->
Get several ICE33 warnings using the ProgId element
but these apparently can safely be ignored
according to a post on the wix-users list by
Rob Mencshing. Also using the ProgId element
does not create the ProgId table. The current installer
no longer uses the ProgId but instead uses Registry
keys instead. It still creates the same entries in the
msi.
http://sourceforge.net/mailarchive/message.php?msg_id=9075241
Note that the Target of the form [#FileId] expands out to the
full path of the file. A target of the form [!FileId]
expands to the short name of the file (i.e. it includes ~
characters). We need the full path otherwise the exe name
will be something like SharpDev~1.exe and the
SharpDevelop.exe.manifest file will not be found when
running the application so it does not use XP visual styles.
Unfortunately using [#FileId] generates lots of ICE69
warnings for the icon and the SharpDevelop.exe target
if they are in a different component.
Not sure why [!FileId] does not produce an error since
the problem seems to be similar, basically the registry
key generated by the ProgId element belongs to one
component whilst we are referencing another component
containing the SharpDevelop.exe and another
containing the icon.
http://msdn.microsoft.com/library/en-us/msi/setup/ice69.asp
The ICE69 errors can be ignored for now since the component
being referenced by the file associations will always be installed
even though it is in a different feature. If the FileTypeRegister
addin is an optional install then the ICE69 errors would need to
be resolved.
We are not using the ProgId element which sets up the
file association registry keys for us, but are specifying them
directly as registry keys. This allows us to use one of the keys
as a key path instead of having to use the parent component's
directory as the key path. The key path is what is used
by the installer to detect whether the component is installed.
Using the component's parent directory (i.e. the Bin folder)
is not feasible since the file associations may not be installed
if the user does not install them in the feature tree.
-->
<RegistryValue Id="SD.booprojfile" Root="HKCR" Type="string" Key="SD.booprojfile" Value="Boo Project" KeyPath="yes" />
<RegistryValue Id="SD.booprojfile.command" Root="HKCR" Type="string" Key="SD.booprojfile\shell\open\command" Value="&quot;[#SharpDevelop.exe]&quot; &quot;%1&quot;" />
<RegistryValue Id="SD.booprojfile.icon" Root="HKCR" Type="string" Key="SD.booprojfile\DefaultIcon" Value="&quot;[#prjx.ico]&quot;" />
@ -947,13 +947,13 @@ @@ -947,13 +947,13 @@
</Directory>
</Directory>
<!--
<Directory Id="XamlBinding" Name="XamlBinding">
<Component Guid="9FEAE5CB-1AF6-4D5D-A2C3-1F92E452299D" Id="XamlBindingFiles" DiskId="1">
<File Source="..\..\AddIns\AddIns\BackendBindings\XamlBinding\XamlBinding.addin" Id="XamlBinding.addin" Name="XamlBinding.addin" />
<File Source="..\..\AddIns\AddIns\BackendBindings\XamlBinding\ICSharpCode.XamlBinding.dll" Id="ICSharpCode.XamlBinding.dll" Name="ICSharpCode.XamlBinding.dll" />
</Component>
</Directory>
-->
<Directory Id="XamlBinding" Name="XamlBinding">
<Component Guid="9FEAE5CB-1AF6-4D5D-A2C3-1F92E452299D" Id="XamlBindingFiles" DiskId="1">
<File Source="..\..\AddIns\AddIns\BackendBindings\XamlBinding\XamlBinding.addin" Id="XamlBinding.addin" Name="XamlBinding.addin" />
<File Source="..\..\AddIns\AddIns\BackendBindings\XamlBinding\ICSharpCode.XamlBinding.dll" Id="ICSharpCode.XamlBinding.dll" Name="ICSharpCode.XamlBinding.dll" />
</Component>
</Directory>
-->
<Directory Id="PythonBinding" Name="PythonBinding">
<Component Guid="AF97A77A-F986-4284-BC0A-9568B1419FC1" Id="IpyExe" DiskId="1">
<File Source="..\..\AddIns\AddIns\BackendBindings\PythonBinding\ipy.exe" Name="ipy.exe" Id="ipy.exe" KeyPath="yes" Assembly=".net" AssemblyApplication="ipy.exe" AssemblyManifest="ipy.exe">
@ -1037,6 +1037,14 @@ @@ -1037,6 +1037,14 @@
<netfx:NativeImage Id="MicrosoftScriptingDebuggingDllNGenImage" Priority="1" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension" />
</File>
</Component>
<Directory Id="TestRunner" Name="TestRunner">
<Component Id="PythonBindingSdTestPy" Guid="7D87D983-8924-456E-8E66-2C6AC76C16A6" DiskId="1">
<File Id="sdtest.py" Name="sdtest.py" Source="..\..\AddIns\AddIns\BackendBindings\PythonBinding\TestRunner\sdtest.py" KeyPath="yes" />
</Component>
<Component Id="PythonBindingSdTestRunnerPy" Guid="E15A20D3-BAA0-476F-9380-0B662D5C8D1E" DiskId="1">
<File Id="sdtestrunner.py" Name="sdtestrunner.py" Source="..\..\AddIns\AddIns\BackendBindings\PythonBinding\TestRunner\sdtestrunner.py" KeyPath="yes" />
</Component>
</Directory>
</Directory>
<Directory Id="FSharpBinding" Name="FSharpBinding">
<Component Guid="6B4F28AF-133C-4FEB-98DB-67A5405AEB12" Id="FSharpBindingAddin" DiskId="1">
@ -1182,35 +1190,35 @@ @@ -1182,35 +1190,35 @@
</Component>
</Directory>
<!--<Directory Id="WorkflowDesignerFolder" Name="WorkflowDesigner">
<Component Guid="0A5A0835-4280-4E64-9BBE-A87E7BCF640B" Id="WorkflowDesignerAddin" DiskId="1">
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\WorkflowDesigner.addin" Id="WorkflowDesigner.addin" Name="WorkflowDesigner.addin" />
</Component>
<Component Guid="69BD4F05-0ADD-48C9-AD46-72D9B0C4A569" Id="WorkflowDesignerDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\WorkflowDesigner.dll" Id="WorkflowDesigner.dll" Name="WorkflowDesigner.dll" />
</Component>-->
<!-- <Directory Id="WorkflowDesignerTemplatesFolder" Name="Templates">
<Directory Id="WorkflowDesignerFilesFolder" Name="Files">
<Component Guid="DA3146B7-E769-4240-9C6E-74956A395782" Id="NoCodeSequentialWorkflowXft" DiskId="1">
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Files\NoCodeSequentialWorkflow.xft" Id="NoCodeSequentialWorkflow.xft" Name="NoCodeSequentialWorkflow.xft" />
<Component Guid="0A5A0835-4280-4E64-9BBE-A87E7BCF640B" Id="WorkflowDesignerAddin" DiskId="1">
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\WorkflowDesigner.addin" Id="WorkflowDesigner.addin" Name="WorkflowDesigner.addin" />
</Component>
<Directory Id="WorkflowDesignerCSharpFilesFolder" Name="CSharp">
<Component Guid="D1C07A4B-45D7-440D-A0AC-AD1ED73CDD6F" Id="WorkflowDesignerCSharpFilesTemplates" DiskId="1">
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Files\CSharp\Activity.xft" Name="Activity.xft" Id="Activity.xft" />
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Files\CSharp\CodeSeparationSequentialWorkflow.xft" Id="CodeSeparationSequentialWorkflow.xft" Name="CodeSeparationSequentialWorkflow.xft" />
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Files\CSharp\CodeSequentialWorkflow.xft" Id="CodeSequentialWorkflow.xft" Name="CodeSequentialWorkflow.xft" />
</Component>
</Directory>
</Directory>
<Directory Id="WorkflowDesignerProjectsFolder" Name="Projects">
<Directory Id="WorkflowDesignerCSharpProjectsFolder" Name="CSharp">
<Component Guid="1114229A-8154-4A4B-A347-AA226D56C8F5" Id="WorkflowDesignerCSharpProjectTemplates" DiskId="1">
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Projects\CSharp\ActivityLibrary.xpt" Id="ActivityLibrary.xpt" Name="ActivityLibrary.xpt" />
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Projects\CSharp\ConsoleProject.xpt" Id="ConsoleProject.xpt" Name="ConsoleProject.xpt" />
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Projects\CSharp\EmptyProject.xpt" Id="EmptyProject.xpt" Name="EmptyProject.xpt" />
</Component>
</Directory>
</Directory>
</Directory> -->
<Component Guid="69BD4F05-0ADD-48C9-AD46-72D9B0C4A569" Id="WorkflowDesignerDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\WorkflowDesigner.dll" Id="WorkflowDesigner.dll" Name="WorkflowDesigner.dll" />
</Component>-->
<!-- <Directory Id="WorkflowDesignerTemplatesFolder" Name="Templates">
<Directory Id="WorkflowDesignerFilesFolder" Name="Files">
<Component Guid="DA3146B7-E769-4240-9C6E-74956A395782" Id="NoCodeSequentialWorkflowXft" DiskId="1">
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Files\NoCodeSequentialWorkflow.xft" Id="NoCodeSequentialWorkflow.xft" Name="NoCodeSequentialWorkflow.xft" />
</Component>
<Directory Id="WorkflowDesignerCSharpFilesFolder" Name="CSharp">
<Component Guid="D1C07A4B-45D7-440D-A0AC-AD1ED73CDD6F" Id="WorkflowDesignerCSharpFilesTemplates" DiskId="1">
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Files\CSharp\Activity.xft" Name="Activity.xft" Id="Activity.xft" />
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Files\CSharp\CodeSeparationSequentialWorkflow.xft" Id="CodeSeparationSequentialWorkflow.xft" Name="CodeSeparationSequentialWorkflow.xft" />
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Files\CSharp\CodeSequentialWorkflow.xft" Id="CodeSequentialWorkflow.xft" Name="CodeSequentialWorkflow.xft" />
</Component>
</Directory>
</Directory>
<Directory Id="WorkflowDesignerProjectsFolder" Name="Projects">
<Directory Id="WorkflowDesignerCSharpProjectsFolder" Name="CSharp">
<Component Guid="1114229A-8154-4A4B-A347-AA226D56C8F5" Id="WorkflowDesignerCSharpProjectTemplates" DiskId="1">
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Projects\CSharp\ActivityLibrary.xpt" Id="ActivityLibrary.xpt" Name="ActivityLibrary.xpt" />
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Projects\CSharp\ConsoleProject.xpt" Id="ConsoleProject.xpt" Name="ConsoleProject.xpt" />
<File Source="..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\Templates\Projects\CSharp\EmptyProject.xpt" Id="EmptyProject.xpt" Name="EmptyProject.xpt" />
</Component>
</Directory>
</Directory>
</Directory> -->
<!-- </Directory> -->
<Directory Id="AvalonEdit" Name="AvalonEdit">
<Component Guid="A3376E4E-F07D-4554-ABF5-E91F2DA918E3" Id="AvalonEditAddInAddin" DiskId="1">
@ -1458,80 +1466,80 @@ @@ -1458,80 +1466,80 @@
</Component>
</Directory>
<!--<Directory Id="SharpDevelopReports" Name="SharpDevelopReports">
<Component Guid="F5963875-6D36-4789-8129-7224EA7434E0" Id="SharpDevelopReportsEmptyReportFileTemplate" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\EmptyReport.xft" Name="EmptyReport.xft" Id="SharpDevelopReportsEmptyReport.xft" KeyPath="yes" />
</Component>
<Component Guid="428E9B37-E8B7-4A23-99A8-0212AB51B201" Id="ICSharpCodeReportDesignerAddin" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\ICSharpCode.ReportDesigner.addin" Name="ICSharpCode.ReportDesigner.addin" Id="ICSharpCode.ReportDesigner.addin" KeyPath="yes" />
</Component>
<Component Guid="8C6177C2-455B-407C-9628-C286AF042100" Id="ICSharpCodeReportsAddinDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\ICSharpCode.Reports.Addin.dll" Name="ICSharpCode.Reports.Addin.dll" Id="ICSharpCode.Reports.Addin.dll" KeyPath="yes" Assembly=".net" AssemblyApplication="ICSharpCode.Reports.Addin.dll" AssemblyManifest="ICSharpCode.Reports.Addin.dll" />
</Component>
<Component Guid="3F3BA5B0-7C06-4DEA-9D61-9AA3FB70CA3C" Id="ICSharpCodeReportsCoreDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\ICSharpCode.Reports.Core.dll" Name="ICSharpCode.Reports.Core.dll" Id="ICSharpCode.Reports.Core.dll" KeyPath="yes" Assembly=".net" AssemblyApplication="ICSharpCode.Reports.Core.dll" AssemblyManifest="ICSharpCode.Reports.Core.dll" />
</Component>
<Component Guid="1A9CDE4B-0A0D-4B1F-9947-365FC93A1956" Id="InteropAdodbDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\Interop.ADODB.dll" Name="Interop.ADODB.dll" Id="Interop.ADODB.dll" KeyPath="yes" Assembly=".net" AssemblyApplication="Interop.ADODB.dll" AssemblyManifest="Interop.ADODB.dll" />
</Component>
<Component Guid="6C7B83C6-F3CB-4CDE-99FF-84986FB8539B" Id="InteropMsdascDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\Interop.MSDASC.dll" Name="Interop.MSDASC.dll" Id="Interop.MSDASC.dll" KeyPath="yes" Assembly=".net" AssemblyApplication="Interop.MSDASC.dll" AssemblyManifest="Interop.MSDASC.dll" />
</Component>
<Component Guid="6A8AA4D2-6CC6-4A03-9705-91FC39818A29" Id="IronyDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\Irony.dll" Name="Irony.dll" Id="Irony.dll" KeyPath="yes" />
</Component>
<Component Guid="CF7C7E01-B229-4E72-92CA-66B9935DE79A" Id="ITextSharpDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\itextsharp.dll" Name="itextsharp.dll" Id="itextsharp.dll" KeyPath="yes" />
</Component>
</Directory>-->
<Component Guid="F5963875-6D36-4789-8129-7224EA7434E0" Id="SharpDevelopReportsEmptyReportFileTemplate" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\EmptyReport.xft" Name="EmptyReport.xft" Id="SharpDevelopReportsEmptyReport.xft" KeyPath="yes" />
</Component>
<Component Guid="428E9B37-E8B7-4A23-99A8-0212AB51B201" Id="ICSharpCodeReportDesignerAddin" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\ICSharpCode.ReportDesigner.addin" Name="ICSharpCode.ReportDesigner.addin" Id="ICSharpCode.ReportDesigner.addin" KeyPath="yes" />
</Component>
<Component Guid="8C6177C2-455B-407C-9628-C286AF042100" Id="ICSharpCodeReportsAddinDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\ICSharpCode.Reports.Addin.dll" Name="ICSharpCode.Reports.Addin.dll" Id="ICSharpCode.Reports.Addin.dll" KeyPath="yes" Assembly=".net" AssemblyApplication="ICSharpCode.Reports.Addin.dll" AssemblyManifest="ICSharpCode.Reports.Addin.dll" />
</Component>
<Component Guid="3F3BA5B0-7C06-4DEA-9D61-9AA3FB70CA3C" Id="ICSharpCodeReportsCoreDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\ICSharpCode.Reports.Core.dll" Name="ICSharpCode.Reports.Core.dll" Id="ICSharpCode.Reports.Core.dll" KeyPath="yes" Assembly=".net" AssemblyApplication="ICSharpCode.Reports.Core.dll" AssemblyManifest="ICSharpCode.Reports.Core.dll" />
</Component>
<Component Guid="1A9CDE4B-0A0D-4B1F-9947-365FC93A1956" Id="InteropAdodbDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\Interop.ADODB.dll" Name="Interop.ADODB.dll" Id="Interop.ADODB.dll" KeyPath="yes" Assembly=".net" AssemblyApplication="Interop.ADODB.dll" AssemblyManifest="Interop.ADODB.dll" />
</Component>
<Component Guid="6C7B83C6-F3CB-4CDE-99FF-84986FB8539B" Id="InteropMsdascDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\Interop.MSDASC.dll" Name="Interop.MSDASC.dll" Id="Interop.MSDASC.dll" KeyPath="yes" Assembly=".net" AssemblyApplication="Interop.MSDASC.dll" AssemblyManifest="Interop.MSDASC.dll" />
</Component>
<Component Guid="6A8AA4D2-6CC6-4A03-9705-91FC39818A29" Id="IronyDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\Irony.dll" Name="Irony.dll" Id="Irony.dll" KeyPath="yes" />
</Component>
<Component Guid="CF7C7E01-B229-4E72-92CA-66B9935DE79A" Id="ITextSharpDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SharpDevelopReports\itextsharp.dll" Name="itextsharp.dll" Id="itextsharp.dll" KeyPath="yes" />
</Component>
</Directory>-->
</Directory>
</Directory>
</Directory>
<Component Guid="542E5AE1-286C-4CE6-8800-F3AFBB24531D" Id="SharpDevelopWebsiteShortcut" DiskId="1">
<!--
The choice here is to either useW the IniFile element to
generate the two website shortcuts or create a
SharpDevelop.url file on disk and use a File element and
link to the file instead. We will use a file otherwise an
upgrade will not remove the existing website shortcut.
-->
The choice here is to either useW the IniFile element to
generate the two website shortcuts or create a
SharpDevelop.url file on disk and use a File element and
link to the file instead. We will use a file otherwise an
upgrade will not remove the existing website shortcut.
-->
<File Id="SharpDevelop.url" KeyPath="yes" Name="SharpDevelop.url" Source="Files\SharpDevelop.url" />
<!--
ICE18 - Force the empty folder to be created. Even though it
has sub folders the validator flags this as an error.
http://msdn.microsoft.com/library/en-us/msi/setup/ice18.asp
-->
ICE18 - Force the empty folder to be created. Even though it
has sub folders the validator flags this as an error.
http://msdn.microsoft.com/library/en-us/msi/setup/ice18.asp
-->
<CreateFolder />
</Component>
<Component Id="SharpDevelopAppPathRegistrySetting" Guid="E812C3C9-1753-4535-80B9-BD8BCE7DB1A5">
<!--
App Path registry setting lives in HKLM so only add it if the
user has admin rights.
-->
App Path registry setting lives in HKLM so only add it if the
user has admin rights.
-->
<Condition>Privileged</Condition>
<RegistryValue Id="SharpDevelopAppPathRegistryKey" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\SharpDevelop.exe" Root="HKLM" Value="[!SharpDevelop.exe]" Type="string" Action="write" />
</Component>
<!--
Dummy components that are empty. These are used so
the feature tree does not show the Network installation
as an option.
-->
Dummy components that are empty. These are used so
the feature tree does not show the Network installation
as an option.
-->
<Component Id="DummyCompleteFeatureComponent" Guid="22AB4C49-89FD-413F-8A1D-456AFB1AD611">
<!--
Fix ICE18 error. The validator thinks that the install folder
could be empty so we have to use CreateFolder in this component.
http://msdn.microsoft.com/library/en-us/msi/setup/ice18.asp
-->
Fix ICE18 error. The validator thinks that the install folder
could be empty so we have to use CreateFolder in this component.
http://msdn.microsoft.com/library/en-us/msi/setup/ice18.asp
-->
<CreateFolder />
</Component>
<Component Id="DummyFileAssocationFeatureComponent" Guid="F0390EC4-6B66-4823-B4F4-7F29E3D6AB54">
<!--
Fix ICE18 error. The validator thinks that the install folder
could be empty so we have to use CreateFolder in this component.
http://msdn.microsoft.com/library/en-us/msi/setup/ice18.asp
-->
Fix ICE18 error. The validator thinks that the install folder
could be empty so we have to use CreateFolder in this component.
http://msdn.microsoft.com/library/en-us/msi/setup/ice18.asp
-->
<CreateFolder />
</Component>
</Directory>
@ -1541,9 +1549,9 @@ @@ -1541,9 +1549,9 @@
<Directory Id="ProgramMenuFolder" Name="Programs">
<Component Id="SharpDevelopProgramMenuItems" Guid="A505F0F2-5971-436D-8E3E-ABDDC0B59BF7">
<!--
Fix ICE 38 by adding a dummy registry key that is the key for this shortcut.
http://msdn.microsoft.com/library/en-us/msi/setup/ice38.asp
-->
Fix ICE 38 by adding a dummy registry key that is the key for this shortcut.
http://msdn.microsoft.com/library/en-us/msi/setup/ice38.asp
-->
<RegistryValue Id="SharpDevelopExeStartMenuShortcutRegistryKey" Root="HKCU" Type="string" KeyPath="yes" Key="Software\SharpDevelop4" Name="ProgramFilesShortcut" Value="1" />
<Shortcut Name="SharpDevelop 4.0" Target="[!SharpDevelop.exe]" Id="SharpDevelopExeStartMenuShortcut" WorkingDirectory="BinFolder" Icon="SharpDevelopIcon.exe" Directory="ProgramMenuFolder" />
</Component>
@ -1552,9 +1560,9 @@ @@ -1552,9 +1560,9 @@
<Directory Id="DesktopFolder" Name="Desktop">
<Component Id="DesktopFolderItems" Guid="F2FF4C2F-6282-4ABA-8DBB-E50E81B5920D">
<!--
Fix ICE 38 by adding a dummy registry key that is the key for this shortcut.
http://msdn.microsoft.com/library/en-us/msi/setup/ice38.asp
-->
Fix ICE 38 by adding a dummy registry key that is the key for this shortcut.
http://msdn.microsoft.com/library/en-us/msi/setup/ice38.asp
-->
<RegistryValue Id="SharpDevelopExeDesktopShortcutRegistryKey" Type="string" Root="HKCU" KeyPath="yes" Key="Software\SharpDevelop4" Name="DesktopShortcut" Value="1" />
<Shortcut Id="SharpDevelopExeDesktopShortcut" Directory="DesktopFolder" Target="[!SharpDevelop.exe]" Name="SharpDevelop 4.0" Icon="SharpDevelopIcon.exe" WorkingDirectory="BinFolder" />
</Component>

8
src/Setup/Setup.wxs

@ -376,9 +376,9 @@ @@ -376,9 +376,9 @@
<ComponentRef Id="PartCoverFrameworkDll"/>
<ComponentRef Id="PartCoverToNCoverXslt"/>
<ComponentRef Id="PythonConsoleProjectTemplate"/>
<ComponentRef Id="PythonEmptyClassTemplate"/>
<ComponentRef Id="PythonEmptyFormTemplate"/>
<ComponentRef Id="PythonConsoleProjectTemplate"/>
<ComponentRef Id="PythonEmptyClassTemplate"/>
<ComponentRef Id="PythonEmptyFormTemplate"/>
<ComponentRef Id="PythonEmptyUserControlTemplate"/>
<ComponentRef Id="PythonEmptyFileTemplate"/>
<ComponentRef Id="PythonFormsProjectTemplate"/>
@ -398,6 +398,8 @@ @@ -398,6 +398,8 @@
<ComponentRef Id="PythonBindingLibSitePy"/>
<ComponentRef Id="PythonBindingLibFuturePy"/>
<ComponentRef Id="SharpDevelopBuildPythonTargets"/>
<ComponentRef Id="PythonBindingSdTestPy"/>
<ComponentRef Id="PythonBindingSdTestRunnerPy"/>
<ComponentRef Id="IrExe"/>
<ComponentRef Id="IrExeConfig"/>

Loading…
Cancel
Save