Skip to content

Commit

Permalink
Fix/skip tests on unix/mac.
Browse files Browse the repository at this point in the history
  • Loading branch information
spraints committed Sep 13, 2012
1 parent fd973ee commit 28a199a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 11 deletions.
6 changes: 3 additions & 3 deletions GitTfsTest/Core/ExtTests.cs
Expand Up @@ -73,10 +73,10 @@ public void ShouldReturnSingleArgumentWhenProvided()
[Fact] [Fact]
public void ShouldCombineSeveralPaths() public void ShouldCombineSeveralPaths()
{ {
Assert.Equal("a\\b\\c", Ext.CombinePaths("a", "b", "c")); Assert.Equal(Path.Combine(Path.Combine("a", "b"), "c"), Ext.CombinePaths("a", "b", "c"));
} }


[Fact] [FactExceptOnUnix]
public void ShouldIgnorePathPartsBeforeAbsolute() public void ShouldIgnorePathPartsBeforeAbsolute()
{ {
Assert.Equal("c:\\x\\y", Ext.CombinePaths("a", "b", "c:\\x", "y")); Assert.Equal("c:\\x\\y", Ext.CombinePaths("a", "b", "c:\\x", "y"));
Expand Down Expand Up @@ -156,4 +156,4 @@ public void ShouldDetectMultivaluesThatIntersectAndAreASubset()


#endregion #endregion
} }
} }
33 changes: 33 additions & 0 deletions GitTfsTest/FactExceptOnUnix.cs
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Sdk;

namespace Sep.Git.Tfs.Test
{
public class FactExceptOnUnixAttribute : FactAttribute
{
protected override IEnumerable<ITestCommand> EnumerateTestCommands(IMethodInfo method)
{
yield return new FactExceptOnUnixTestCommand(method);
}

class FactExceptOnUnixTestCommand : FactCommand
{
public FactExceptOnUnixTestCommand(IMethodInfo method) : base(method) { }

public override MethodResult Execute(object testClass)
{
if(IsUnix())
return new SkipResult(testMethod, DisplayName, "This test does not work on unix-like OSes yet.");

return base.Execute(testClass);
}

private bool IsUnix()
{
return Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX;
}
}
}
}
3 changes: 2 additions & 1 deletion GitTfsTest/GitTfsTest.csproj
Expand Up @@ -86,6 +86,7 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="FactExceptOnUnix.cs" />
<Compile Include="Commands\HelpTest.cs" /> <Compile Include="Commands\HelpTest.cs" />
<Compile Include="Commands\ShelveTest.cs" /> <Compile Include="Commands\ShelveTest.cs" />
<Compile Include="Core\DelimitedReaderTests.cs" /> <Compile Include="Core\DelimitedReaderTests.cs" />
Expand Down Expand Up @@ -152,4 +153,4 @@
<Target Name="AfterBuild"> <Target Name="AfterBuild">
</Target> </Target>
--> -->
</Project> </Project>
14 changes: 7 additions & 7 deletions GitTfsTest/Integration/CloneTests.cs
Expand Up @@ -21,12 +21,12 @@ public void Dispose()
h.Dispose(); h.Dispose();
} }


[Fact(Skip="eventually")] [FactExceptOnUnix(Skip="eventually")]
public void FailOnNoProject() public void FailOnNoProject()
{ {
} }


[Fact(Skip="eventually")] [FactExceptOnUnix(Skip="eventually")]
public void ClonesEmptyProject() public void ClonesEmptyProject()
{ {
h.SetupFake(r => h.SetupFake(r =>
Expand All @@ -43,7 +43,7 @@ public void ClonesEmptyProject()
h.AssertEmptyWorkspace("MyProject"); h.AssertEmptyWorkspace("MyProject");
} }


[Fact] [FactExceptOnUnix]
public void CloneProjectWithChangesets() public void CloneProjectWithChangesets()
{ {
h.SetupFake(r => h.SetupFake(r =>
Expand All @@ -65,7 +65,7 @@ public void CloneProjectWithChangesets()
h.AssertFileInWorkspace("MyProject", "README", "tldr"); h.AssertFileInWorkspace("MyProject", "README", "tldr");
} }


[Fact] [FactExceptOnUnix]
public void CloneProjectWithInternationalCharactersInFileNamesAndFolderNames() public void CloneProjectWithInternationalCharactersInFileNamesAndFolderNames()
{ {
h.SetupFake(r => h.SetupFake(r =>
Expand All @@ -82,7 +82,7 @@ public void CloneProjectWithInternationalCharactersInFileNamesAndFolderNames()
h.AssertFileInWorkspace("MyProject", "ÆØÅ/äöü.txt", "File contents"); h.AssertFileInWorkspace("MyProject", "ÆØÅ/äöü.txt", "File contents");
} }


[Fact] [FactExceptOnUnix]
public void CloneProjectWithInternationalCharactersInFileContents() public void CloneProjectWithInternationalCharactersInFileContents()
{ {
h.SetupFake(r => h.SetupFake(r =>
Expand All @@ -99,7 +99,7 @@ public void CloneProjectWithInternationalCharactersInFileContents()
h.AssertFileInWorkspace("MyProject", "Folder/File.txt", "Blåbærsyltetøy er godt!"); h.AssertFileInWorkspace("MyProject", "Folder/File.txt", "Blåbærsyltetøy er godt!");
} }


[Fact] [FactExceptOnUnix]
public void CloneProjectWithInternationalCharactersInCommitMessages() public void CloneProjectWithInternationalCharactersInCommitMessages()
{ {
h.SetupFake(r => h.SetupFake(r =>
Expand All @@ -123,7 +123,7 @@ private void AssertRefs(string expectedSha)
h.AssertRef("MyProject", "tfs/default", expectedSha); h.AssertRef("MyProject", "tfs/default", expectedSha);
} }


[Fact] [FactExceptOnUnix]
public void CloneWithMixedUpCase() public void CloneWithMixedUpCase()
{ {
h.SetupFake(r => h.SetupFake(r =>
Expand Down

1 comment on commit 28a199a

@sc68cal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍺

Please sign in to comment.