diff options
author | Matt Ward <ward.matt@gmail.com> | 2014-02-12 21:14:55 +0400 |
---|---|---|
committer | Matt Ward <ward.matt@gmail.com> | 2014-02-12 21:14:55 +0400 |
commit | 0f04715e2a8081456253def9687fd59193231230 (patch) | |
tree | 84b7b63385f900c870f6befcb4e0e09dc2210102 /main/tests | |
parent | d9eba24eafd74dfe772568ae51c6578dd576b139 (diff) | |
parent | 38a5f2cbdb88f3ef83b500c5ec319d5de90d3f4e (diff) |
Merge branch 'master' into nuget-integration
Diffstat (limited to 'main/tests')
10 files changed, 264 insertions, 16 deletions
diff --git a/main/tests/TestRunner/AddinInfo.cs b/main/tests/TestRunner/AddinInfo.cs new file mode 100644 index 0000000000..3f432f5738 --- /dev/null +++ b/main/tests/TestRunner/AddinInfo.cs @@ -0,0 +1,14 @@ + +using System; +using Mono.Addins; +using Mono.Addins.Description; + +[assembly:Addin ("TestRunner", + Namespace = "MonoDevelop", + Version = MonoDevelop.BuildInfo.Version, + Category = "MonoDevelop Core")] + +[assembly:AddinName ("Test Runner")] +[assembly:AddinDescription ("Test runner for the MonoDevelop unit tests")] + +[assembly:AddinDependency ("Core", MonoDevelop.BuildInfo.Version)] diff --git a/main/tests/TestRunner/MonoDevelop.TestRunner.addin.xml b/main/tests/TestRunner/MonoDevelop.TestRunner.addin.xml index 7c7c9cd9e0..f2b1a0acd2 100644 --- a/main/tests/TestRunner/MonoDevelop.TestRunner.addin.xml +++ b/main/tests/TestRunner/MonoDevelop.TestRunner.addin.xml @@ -1,19 +1,7 @@ -<Addin id = "TestRunner" - namespace = "MonoDevelop" - name = "Test Runner" - copyright = "MIT/X11" - url = "http://www.monodevelop.com" - description = "Test runner for the MonoDevelop unit tests" - category = "MonoDevelop Core" - isroot = "false" - version = "4.2.3" - compatVersion = "4.0"> +<ExtensionModel> - <Dependencies> - <Addin id="Core" version="4.2.3"/> - </Dependencies> - <Extension path = "/MonoDevelop/Core/Applications"> <Application id = "run-md-tests" class = "MonoDevelop.Tests.TestRunner.Runer" description = "Runs the MonoDevelop unit test suite"/> </Extension> -</Addin> + +</ExtensionModel> diff --git a/main/tests/TestRunner/TestRunner.csproj b/main/tests/TestRunner/TestRunner.csproj index 4aa0546920..2101e9a64a 100644 --- a/main/tests/TestRunner/TestRunner.csproj +++ b/main/tests/TestRunner/TestRunner.csproj @@ -48,6 +48,7 @@ <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Runner.cs" /> + <Compile Include="AddinInfo.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ItemGroup> diff --git a/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs b/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs index 804d6563b6..a87347d514 100644 --- a/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs +++ b/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs @@ -430,5 +430,20 @@ namespace MonoDevelop.Projects { LoadBuildVSConsoleProject ("2013", "12.0"); } + + [Test] + public void SaveReferenceWithCondition () + { + string solFile = Util.GetSampleProject ("console-project-conditional-reference", "ConsoleProject.sln"); + Solution sol = Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile) as Solution; + + string proj = sol.GetAllProjects ().First ().FileName; + + string projectXml1 = Util.GetXmlFileInfoset (proj); + sol.Save (new NullProgressMonitor ()); + + string projectXml2 = Util.GetXmlFileInfoset (proj); + Assert.AreEqual (projectXml1, projectXml2); + } } } diff --git a/main/tests/UnitTests/MonoDevelop.SourceEditor/JSonIndentEngineTests.cs b/main/tests/UnitTests/MonoDevelop.SourceEditor/JSonIndentEngineTests.cs new file mode 100644 index 0000000000..ac7b5d0d40 --- /dev/null +++ b/main/tests/UnitTests/MonoDevelop.SourceEditor/JSonIndentEngineTests.cs @@ -0,0 +1,108 @@ +// +// JSonIndentEngineTests.cs +// +// Author: +// Mike Krüger <mkrueger@xamarin.com> +// +// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using NUnit.Framework; +using MonoDevelop.Ide.CodeCompletion; +using ICSharpCode.NRefactory.CSharp; +using System.Text; +using ICSharpCode.NRefactory.Editor; +using MonoDevelop.SourceEditor.JSon; +using Mono.TextEditor; + +namespace MonoDevelop.SourceEditor +{ + [TestFixture] + public class JSonIndentEngineTests + { + public static IDocumentIndentEngine CreateEngine (string text) + { + var sb = new StringBuilder (); + int offset = 0; + for (int i = 0; i < text.Length; i++) { + var ch = text [i]; + if (ch == '$') { + offset = i; + continue; + } + sb.Append (ch); + } + + var data = new TextEditorData (); + data.Text = sb.ToString (); + var csi = new JSonIndentEngine (data); + var result = new CacheIndentEngine (csi); + result.Update (offset); + return result; + } + + [Test] + public void TestBracketIndentation () + { + var engine = CreateEngine ( + @" +{ +$ +"); + Assert.AreEqual ("\t", engine.ThisLineIndent); + Assert.AreEqual ("\t", engine.NextLineIndent); + } + + [Test] + public void TestBodyIndentation () + { + var engine = CreateEngine ( + @" +{ + ""foo"":""bar"", +$ +"); + Assert.AreEqual ("\t", engine.ThisLineIndent); + Assert.AreEqual ("\t", engine.NextLineIndent); + } + + [Test] + public void TestArrayIndentation () + { + var engine = CreateEngine ( + @" +{ + ""test"":[ +$ +"); + Assert.AreEqual ("\t\t", engine.ThisLineIndent); + Assert.AreEqual ("\t\t", engine.NextLineIndent); + } + + [Test] + public void TestWindowsEOL () + { + var engine = CreateEngine ("\r\n{\r\n$\r\n"); + Assert.AreEqual ("\t", engine.ThisLineIndent); + Assert.AreEqual ("\t", engine.NextLineIndent); + } + } +} + diff --git a/main/tests/UnitTests/UnitTests.csproj b/main/tests/UnitTests/UnitTests.csproj index 693cfae5a2..1de46c8677 100644 --- a/main/tests/UnitTests/UnitTests.csproj +++ b/main/tests/UnitTests/UnitTests.csproj @@ -3,7 +3,7 @@ <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.21022</ProductVersion> + <ProductVersion>8.0.30703</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{1497D0A8-AFF1-4938-BC22-BE79B358BA5B}</ProjectGuid> <OutputType>Library</OutputType> @@ -287,6 +287,7 @@ <Compile Include="MonoDevelop.Refactoring\ProjectGroupingProviderTests.cs" /> <Compile Include="MonoDevelop.Refactoring\FileGroupingProviderTests.cs" /> <Compile Include="MonoDevelop.Ide.Gui\LogViewTests.cs" /> + <Compile Include="MonoDevelop.SourceEditor\JSonIndentEngineTests.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="..\..\md.targets" /> diff --git a/main/tests/test-projects/console-project-conditional-reference/ConsoleProject.sln b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject.sln new file mode 100755 index 0000000000..199aa24543 --- /dev/null +++ b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject.sln @@ -0,0 +1,23 @@ +
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleProject", "ConsoleProject\ConsoleProject.csproj", "{4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = ConsoleProject\ConsoleProject.csproj
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/ConsoleProject.csproj b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/ConsoleProject.csproj new file mode 100755 index 0000000000..1b82a09794 --- /dev/null +++ b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/ConsoleProject.csproj @@ -0,0 +1,51 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>ConsoleProject</RootNamespace> + <AssemblyName>ConsoleProject</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>True</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>False</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>True</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="protobuf-net" Condition=" '$(Configuration)' == 'Debug' "> + <HintPath>..\Lib\Debug\protobuf-net.dll</HintPath> + </Reference> + <Reference Include="protobuf-net" Condition=" '$(Configuration)' != 'Debug' "> + <HintPath>..\Lib\Release\protobuf-net.dll</HintPath> + </Reference> </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> diff --git a/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/Program.cs b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/Program.cs new file mode 100755 index 0000000000..cd4be63967 --- /dev/null +++ b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/Program.cs @@ -0,0 +1,14 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ConsoleProject
+{
+ class Program
+ {
+ static void Main (string[] args)
+ {
+ Console.WriteLine ("Hello world");
+ }
+ }
+}
diff --git a/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/Properties/AssemblyInfo.cs b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/Properties/AssemblyInfo.cs new file mode 100755 index 0000000000..be1e50670d --- /dev/null +++ b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle ("ConsoleProject")]
+[assembly: AssemblyDescription ("")]
+[assembly: AssemblyConfiguration ("")]
+[assembly: AssemblyCompany ("")]
+[assembly: AssemblyProduct ("ConsoleProject")]
+[assembly: AssemblyCopyright ("Copyright © 2008")]
+[assembly: AssemblyTrademark ("")]
+[assembly: AssemblyCulture ("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible (false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid ("a1b85c5f-e506-462a-911c-cbe67c035c93")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion ("1.0.0.0")]
+[assembly: AssemblyFileVersion ("1.0.0.0")]
|