-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #536 from microsoft/revert-535-test-removal
Revert "FunctionalTests: remove GitCommands tests"
- Loading branch information
Showing
16 changed files
with
2,872 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using NUnit.Framework; | ||
using Scalar.FunctionalTests.Properties; | ||
|
||
namespace Scalar.FunctionalTests.Tests.GitCommands | ||
{ | ||
[TestFixtureSource(typeof(GitRepoTests), nameof(GitRepoTests.ValidateWorkingTree))] | ||
[Category(Categories.GitCommands)] | ||
public class AddStageTests : GitRepoTests | ||
{ | ||
public AddStageTests(Settings.ValidateWorkingTreeMode validateWorkingTree) | ||
: base(enlistmentPerTest: false, validateWorkingTree: validateWorkingTree) | ||
{ | ||
} | ||
|
||
[TestCase, Order(1)] | ||
public void AddBasicTest() | ||
{ | ||
this.EditFile("Some new content.", "Readme.md"); | ||
this.ValidateGitCommand("add Readme.md"); | ||
this.RunGitCommand("commit -m \"Changing the Readme.md\""); | ||
} | ||
|
||
[TestCase, Order(2)] | ||
public void StageBasicTest() | ||
{ | ||
this.EditFile("Some new content.", "AuthoringTests.md"); | ||
this.ValidateGitCommand("stage AuthoringTests.md"); | ||
this.RunGitCommand("commit -m \"Changing the AuthoringTests.md\""); | ||
} | ||
|
||
[TestCase, Order(3)] | ||
public void AddAndStageHardLinksTest() | ||
{ | ||
this.CreateHardLink("ReadmeLink.md", "Readme.md"); | ||
this.ValidateGitCommand("add ReadmeLink.md"); | ||
this.RunGitCommand("commit -m \"Created ReadmeLink.md\""); | ||
|
||
this.CreateHardLink("AuthoringTestsLink.md", "AuthoringTests.md"); | ||
this.ValidateGitCommand("stage AuthoringTestsLink.md"); | ||
this.RunGitCommand("commit -m \"Created AuthoringTestsLink.md\""); | ||
} | ||
} | ||
} |
104 changes: 104 additions & 0 deletions
104
Scalar.FunctionalTests/Tests/GitCommands/CherryPickConflictTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
using NUnit.Framework; | ||
using Scalar.FunctionalTests.Properties; | ||
|
||
namespace Scalar.FunctionalTests.Tests.GitCommands | ||
{ | ||
[TestFixtureSource(typeof(GitRepoTests), nameof(GitRepoTests.ValidateWorkingTree))] | ||
[Category(Categories.GitCommands)] | ||
public class CherryPickConflictTests : GitRepoTests | ||
{ | ||
public CherryPickConflictTests(Settings.ValidateWorkingTreeMode validateWorkingTree) | ||
: base(enlistmentPerTest: true, validateWorkingTree: validateWorkingTree) | ||
{ | ||
} | ||
|
||
[TestCase] | ||
public void CherryPickConflict() | ||
{ | ||
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch); | ||
this.ValidateGitCommand("cherry-pick " + GitRepoTests.ConflictSourceBranch); | ||
this.FilesShouldMatchAfterConflict(); | ||
} | ||
|
||
[TestCase] | ||
public void CherryPickConflictWithFileReads() | ||
{ | ||
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch); | ||
this.ReadConflictTargetFiles(); | ||
this.ValidateGitCommand("status"); | ||
this.ValidateGitCommand("cherry-pick " + GitRepoTests.ConflictSourceBranch); | ||
this.FilesShouldMatchAfterConflict(); | ||
} | ||
|
||
[TestCase] | ||
public void CherryPickConflictWithFileReads2() | ||
{ | ||
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch); | ||
this.ReadConflictTargetFiles(); | ||
this.ValidateGitCommand("status"); | ||
this.ValidateGitCommand("cherry-pick " + GitRepoTests.ConflictSourceBranch); | ||
this.FilesShouldMatchAfterConflict(); | ||
this.ValidateGitCommand("cherry-pick --abort"); | ||
this.FilesShouldMatchCheckoutOfTargetBranch(); | ||
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictSourceBranch); | ||
} | ||
|
||
[TestCase] | ||
public void CherryPickConflict_ThenAbort() | ||
{ | ||
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch); | ||
this.ValidateGitCommand("cherry-pick " + GitRepoTests.ConflictSourceBranch); | ||
this.ValidateGitCommand("cherry-pick --abort"); | ||
this.FilesShouldMatchCheckoutOfTargetBranch(); | ||
} | ||
|
||
[TestCase] | ||
public void CherryPickConflict_ThenSkip() | ||
{ | ||
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch); | ||
this.ValidateGitCommand("cherry-pick " + GitRepoTests.ConflictSourceBranch); | ||
this.ValidateGitCommand("cherry-pick --skip"); | ||
this.FilesShouldMatchAfterConflict(); | ||
} | ||
|
||
[TestCase] | ||
public void CherryPickConflict_UsingOurs() | ||
{ | ||
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch); | ||
this.ValidateGitCommand("cherry-pick -Xours " + GitRepoTests.ConflictSourceBranch); | ||
this.FilesShouldMatchAfterConflict(); | ||
} | ||
|
||
[TestCase] | ||
public void CherryPickConflict_UsingTheirs() | ||
{ | ||
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch); | ||
this.ValidateGitCommand("cherry-pick -Xtheirs " + GitRepoTests.ConflictSourceBranch); | ||
this.FilesShouldMatchAfterConflict(); | ||
} | ||
|
||
[TestCase] | ||
public void CherryPickNoCommit() | ||
{ | ||
this.ValidateGitCommand("checkout 170b13ce1990c53944403a70e93c257061598ae0"); | ||
this.ValidateGitCommand("cherry-pick --no-commit " + GitRepoTests.ConflictTargetBranch); | ||
} | ||
|
||
[TestCase] | ||
public void CherryPickNoCommitReset() | ||
{ | ||
this.ValidateGitCommand("checkout 170b13ce1990c53944403a70e93c257061598ae0"); | ||
this.ValidateGitCommand("cherry-pick --no-commit " + GitRepoTests.ConflictTargetBranch); | ||
this.ValidateGitCommand("reset"); | ||
} | ||
|
||
protected override void CreateEnlistment() | ||
{ | ||
base.CreateEnlistment(); | ||
this.ControlGitRepo.Fetch(GitRepoTests.ConflictSourceBranch); | ||
this.ControlGitRepo.Fetch(GitRepoTests.ConflictTargetBranch); | ||
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictSourceBranch); | ||
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch); | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
Scalar.FunctionalTests/Tests/GitCommands/DeleteEmptyFolderTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using NUnit.Framework; | ||
using Scalar.FunctionalTests.Properties; | ||
using Scalar.FunctionalTests.Should; | ||
|
||
namespace Scalar.FunctionalTests.Tests.GitCommands | ||
{ | ||
[TestFixtureSource(typeof(GitRepoTests), nameof(GitRepoTests.ValidateWorkingTree))] | ||
[Category(Categories.GitCommands)] | ||
public class DeleteEmptyFolderTests : GitRepoTests | ||
{ | ||
public DeleteEmptyFolderTests(Settings.ValidateWorkingTreeMode validateWorkingTree) | ||
: base(enlistmentPerTest: true, validateWorkingTree: validateWorkingTree) | ||
{ | ||
} | ||
|
||
[TestCase] | ||
public void VerifyResetHardDeletesEmptyFolders() | ||
{ | ||
this.SetupFolderDeleteTest(); | ||
|
||
this.RunGitCommand("reset --hard HEAD"); | ||
this.Enlistment.RepoRoot.ShouldBeADirectory(this.FileSystem) | ||
.WithDeepStructure(this.FileSystem, this.ControlGitRepo.RootPath, withinPrefixes: this.pathPrefixes); | ||
} | ||
|
||
[TestCase] | ||
public void VerifyCleanDeletesEmptyFolders() | ||
{ | ||
this.SetupFolderDeleteTest(); | ||
|
||
this.RunGitCommand("clean -fd"); | ||
this.Enlistment.RepoRoot.ShouldBeADirectory(this.FileSystem) | ||
.WithDeepStructure(this.FileSystem, this.ControlGitRepo.RootPath, withinPrefixes: this.pathPrefixes); | ||
} | ||
|
||
private void SetupFolderDeleteTest() | ||
{ | ||
this.ControlGitRepo.Fetch("FunctionalTests/20170202_RenameTestMergeTarget"); | ||
this.ValidateGitCommand("checkout FunctionalTests/20170202_RenameTestMergeTarget"); | ||
this.DeleteFile("Test_EPF_GitCommandsTestOnlyFileFolder", "file.txt"); | ||
this.ValidateGitCommand("add ."); | ||
this.RunGitCommand("commit -m\"Delete only file.\""); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
Scalar.FunctionalTests/Tests/GitCommands/EnumerationMergeTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using NUnit.Framework; | ||
using Scalar.FunctionalTests.Properties; | ||
|
||
namespace Scalar.FunctionalTests.Tests.GitCommands | ||
{ | ||
[TestFixtureSource(typeof(GitRepoTests), nameof(GitRepoTests.ValidateWorkingTree))] | ||
[Category(Categories.GitCommands)] | ||
public class EnumerationMergeTest : GitRepoTests | ||
{ | ||
// Commit that found GvFlt Bug 12258777: Entries are sometimes skipped during | ||
// enumeration when they don't fit in a user's buffer | ||
private const string EnumerationReproCommitish = "FunctionalTests/20170602"; | ||
|
||
public EnumerationMergeTest(Settings.ValidateWorkingTreeMode validateWorkingTree) | ||
: base(enlistmentPerTest: true, validateWorkingTree: validateWorkingTree) | ||
{ | ||
} | ||
|
||
[TestCase] | ||
public void ConfirmEnumerationMatches() | ||
{ | ||
this.ControlGitRepo.Fetch(GitRepoTests.ConflictSourceBranch); | ||
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictSourceBranch); | ||
} | ||
|
||
protected override void CreateEnlistment() | ||
{ | ||
this.CreateEnlistment(EnumerationReproCommitish); | ||
} | ||
} | ||
} |
Oops, something went wrong.