-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mac: Add PreDelete Notification #181
Changes from all commits
81afe7f
25fc24a
e9a616c
ac386e5
fa42007
7266b9f
52f6522
0d29e46
522e4e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ namespace GVFS.FunctionalTests.Tests.EnlistmentPerFixture | |
{ | ||
[TestFixtureSource(typeof(FileSystemRunner), FileSystemRunner.TestRunners)] | ||
[Category(Categories.GitCommands)] | ||
[Category(Categories.Mac.M2)] | ||
public class GitMoveRenameTests : TestsWithEnlistmentPerFixture | ||
{ | ||
private string testFileContents = "0123456789"; | ||
|
@@ -31,6 +32,7 @@ public void GitStatus() | |
} | ||
|
||
[TestCase, Order(2)] | ||
[Category(Categories.Mac.M2TODO)] | ||
public void GitStatusAfterNewFile() | ||
{ | ||
string filename = "new.cs"; | ||
|
@@ -48,6 +50,7 @@ public void GitStatusAfterNewFile() | |
} | ||
|
||
[TestCase, Order(3)] | ||
[Category(Categories.Mac.M2TODO)] | ||
public void GitStatusAfterFileNameCaseChange() | ||
{ | ||
string oldFilename = "new.cs"; | ||
|
@@ -65,6 +68,7 @@ public void GitStatusAfterFileNameCaseChange() | |
} | ||
|
||
[TestCase, Order(4)] | ||
[Category(Categories.Mac.M2TODO)] | ||
public void GitStatusAfterFileRename() | ||
{ | ||
string oldFilename = "New.cs"; | ||
|
@@ -82,6 +86,7 @@ public void GitStatusAfterFileRename() | |
} | ||
|
||
[TestCase, Order(5)] | ||
[Category(Categories.Mac.M3)] | ||
public void GitStatusAndObjectAfterGitAdd() | ||
{ | ||
string existingFilename = "test.cs"; | ||
|
@@ -117,6 +122,7 @@ public void GitStatusAndObjectAfterGitAdd() | |
} | ||
|
||
[TestCase, Order(6)] | ||
[Category(Categories.Mac.M3)] | ||
public void GitStatusAfterUnstage() | ||
{ | ||
string existingFilename = "test.cs"; | ||
|
@@ -139,7 +145,7 @@ public void GitStatusAfterUnstage() | |
public void GitStatusAfterFileDelete() | ||
{ | ||
string existingFilename = "test.cs"; | ||
this.Enlistment.GetVirtualPathTo(existingFilename).ShouldBeAFile(this.fileSystem); | ||
this.EnsureTestFileExists(existingFilename); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you need to change the behavior here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately all of the tests in this class were written to be completely dependent on all of the tests running in order.
With this change you can run this individual test without having to run the tests listed above it. |
||
this.fileSystem.DeleteFile(this.Enlistment.GetVirtualPathTo(existingFilename)); | ||
this.Enlistment.GetVirtualPathTo(existingFilename).ShouldNotExistOnDisk(this.fileSystem); | ||
|
||
|
@@ -170,6 +176,7 @@ public void GitWithEnvironmentVariables() | |
} | ||
|
||
[TestCase, Order(9)] | ||
[Category(Categories.Mac.M2TODO)] | ||
public void GitStatusAfterRenameFileIntoRepo() | ||
{ | ||
string filename = "GitStatusAfterRenameFileIntoRepo.cs"; | ||
|
@@ -196,7 +203,7 @@ public void GitStatusAfterRenameFileIntoRepo() | |
[TestCase, Order(10)] | ||
public void GitStatusAfterRenameFileOutOfRepo() | ||
{ | ||
string existingFilename = "Test_EPF_MoveRenameFileTests\\ChangeUnhydratedFileName\\Program.cs"; | ||
string existingFilename = Path.Combine("Test_EPF_MoveRenameFileTests", "ChangeUnhydratedFileName", "Program.cs"); | ||
|
||
// Move the test file to this.Enlistment.EnlistmentRoot as it's outside of src | ||
// and is cleaned up when the functional tests run | ||
|
@@ -210,6 +217,7 @@ public void GitStatusAfterRenameFileOutOfRepo() | |
} | ||
|
||
[TestCase, Order(11)] | ||
[Category(Categories.Mac.M2TODO)] | ||
public void GitStatusAfterRenameFolderIntoRepo() | ||
{ | ||
string folderName = "GitStatusAfterRenameFolderIntoRepo"; | ||
|
@@ -235,5 +243,16 @@ public void GitStatusAfterRenameFolderIntoRepo() | |
folderName + "/", | ||
folderName + "/" + fileName); | ||
} | ||
|
||
private void EnsureTestFileExists(string relativePath) | ||
{ | ||
string filePath = this.Enlistment.GetVirtualPathTo(relativePath); | ||
if (!this.fileSystem.FileExists(filePath)) | ||
{ | ||
this.fileSystem.WriteAllText(filePath, this.testFileContents); | ||
} | ||
|
||
this.Enlistment.GetVirtualPathTo(relativePath).ShouldBeAFile(this.fileSystem); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming
ModifiedPathsShouldContain
toModifiedPathsShouldContainLine
, and move the newline inside the method. That way every caller doesn't have to know this detaillThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that idea, that will also allow for making
ModifiedPathsNewLine
private (as mentioned in a separate comment)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will move the newline inside the method but leave the method named
ModifiedPathsShouldContain
.I found
ModifiedPathsShouldContainLine
looked a bit off as the caller is not passing in lines, it's passing in the paths that ``ModifiedPaths` should (or should not) have.