8000 Update to 75db289a (v0.25) by carlosmn · Pull Request #1394 · libgit2/libgit2sharp · GitHub
[go: up one dir, main page]

Skip to content

Update to 75db289a (v0.25) #1394

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

Merged
merged 6 commits into from
Dec 23, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't try to reset the path by passing in empty strings
The only documented way of resetting a search path is by passing null, all these
other variants may have worked at some point, but that was pure coincidence.
  • Loading branch information
carlosmn committed Dec 17, 2016
commit 00540368baf96c7eca98ef82c928510fe53eb4ca
27 changes: 6 additions & 21 deletions LibGit2Sharp.Tests/ConfigurationFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -455,15 +455,6 @@ public void CanSetAndGetMultipleSearchPaths()
[Fact]
public void CanResetSearchPaths()
{
// all of these calls should reset the config path to the default
Action[] resetActions =
{
() => GlobalSettings.SetConfigSearchPaths(ConfigurationLevel.Global),
() => GlobalSettings.SetConfigSearchPaths(ConfigurationLevel.Global, null),
() => GlobalSettings.SetConfigSearchPaths(ConfigurationLevel.Global, string.Empty),
() => GlobalSettings.SetConfigSearchPaths(ConfigurationLevel.Global, new string[] { }),
};

// record the default search path
GlobalSettings.SetConfigSearchPaths(ConfigurationLevel.Global, null);
var oldPaths = GlobalSettings.GetConfigSearchPaths(ConfigurationLevel.Global);
Expand All @@ -472,19 +463,13 @@ public void CanResetSearchPaths()
// generate a non-default path to set
var newPaths = new string[] { Path.Combine(Constants.TemporaryReposPath, Path.GetRandomFileName()) };

foreach (var tryToReset in resetActions)
{
// change to the non-default path
GlobalSettings.SetConfigSearchPaths(ConfigurationLevel.Global, newPaths);
Assert.Equal(newPaths, GlobalSettings.GetConfigSearchPaths(ConfigurationLevel.Global));

// set it back to the default
tryToReset();
Assert.Equal(oldPaths, GlobalSettings.GetConfigSearchPaths(ConfigurationLevel.Global));
}
// change to the non-default path
GlobalSettings.SetConfigSearchPaths (ConfigurationLevel.Global, newPaths);
Assert.Equal (newPaths, GlobalSettings.GetConfigSearchPaths (ConfigurationLevel.Global));

// make sure the config paths are reset after the test ends
GlobalSettings.SetConfigSearchPaths(ConfigurationLevel.Global, null);
// set it back to the default
GlobalSettings.SetConfigSearchPaths (ConfigurationLevel.Global, null);
Assert.Equal (oldPaths, GlobalSettings.GetConfigSearchPaths (ConfigurationLevel.Global));
}

[Fact]
Expand Down
0