Skip to content
This repository has been archived by the owner on Oct 31, 2021. It is now read-only.

Commit

Permalink
Merge pull request #31 from rneatherway/windows-test
Browse files Browse the repository at this point in the history
Fix windows tests
  • Loading branch information
rneatherway committed Jul 12, 2015
2 parents 45a4675 + 1259e0d commit 9f55431
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
15 changes: 15 additions & 0 deletions tests/Projekt.Tests/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.4.14350" newVersion="2.6.4.14350" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
5 changes: 3 additions & 2 deletions tests/Projekt.Tests/Projekt.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -71,6 +71,7 @@
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Projekt\Projekt.fsproj">
Expand Down Expand Up @@ -114,4 +115,4 @@
<Paket>True</Paket>
</Reference>
</ItemGroup>
</Project>
</Project>
30 changes: 19 additions & 11 deletions tests/Projekt.Tests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ open NUnit.Framework
open Projekt.Util
open FsUnit

let runningOnMono = try System.Type.GetType("Mono.Runtime") <> null with e -> false

let assertDeepEquals expected result =
Assert.IsTrue (XNode.DeepEquals(expected, result),
"Expected: {0}, result: {1}", expected, result)
Expand Down Expand Up @@ -206,17 +208,21 @@ let delInput = """<?xml version="1.0" encoding="utf-8"?>
</Project>
"""

let delExpected = """<?xml version="1.0" encoding="utf-8"?>
let delExpected =
let emptyItemGroup = if runningOnMono then "<ItemGroup></ItemGroup>" else "<ItemGroup />"

"""<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>165a6853-05ed-4f03-a7b1-1c84d4f01bf5</ProjectGuid>
<AssemblyName>Test</AssemblyName>
<Name>Test</Name>
</PropertyGroup>
<ItemGroup>
</ItemGroup>
</Project>
"""
"""
+ emptyItemGroup +
"""
</Project>
"""

[<Test>]
let ``delFile should remove file if present`` () =
Expand Down Expand Up @@ -291,7 +297,9 @@ let delMultipleIGInput = """<?xml version="1.0" encoding="utf-8"?>
</Project>
"""

let delMultipleIGExpected = """<?xml version="1.0" encoding="utf-8"?>
let delMultipleIGExpected =
let emptyItemGroup = if runningOnMono then "<ItemGroup></ItemGroup>" else "<ItemGroup />"
"""<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>165a6853-05ed-4f03-a7b1-1c84d4f01bf5</ProjectGuid>
Expand All @@ -305,11 +313,11 @@ let delMultipleIGExpected = """<?xml version="1.0" encoding="utf-8"?>
<ItemGroup>
<Compile Include="Test3.fs" />
</ItemGroup>
<ItemGroup>
</ItemGroup>
</Project>
"""

"""
+ emptyItemGroup +
"""
</Project>
"""

[<Test>]
let ``delFile should remove file in later ItemGroups`` () =
Expand Down

0 comments on commit 9f55431

Please sign in to comment.