diff options
author | Keith Dahlby <dahlbyk@gmail.com> | 2013-11-20 02:19:41 +0400 |
---|---|---|
committer | Keith Dahlby <dahlbyk@gmail.com> | 2013-11-21 03:50:42 +0400 |
commit | 3cf04dd7244c2de237f7e997505d3edbdf26ff1c (patch) | |
tree | 358b43444daac0f9aa538571dcf6ce8c329bdd94 /LibGit2Sharp.Tests | |
parent | 123bd64e59082735e6ed6f0f16562e3cc1f934da (diff) |
Add Configuration.Find(regexp)
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r-- | LibGit2Sharp.Tests/ConfigurationFixture.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/ConfigurationFixture.cs b/LibGit2Sharp.Tests/ConfigurationFixture.cs index 39c37769..9917d92a 100644 --- a/LibGit2Sharp.Tests/ConfigurationFixture.cs +++ b/LibGit2Sharp.Tests/ConfigurationFixture.cs @@ -227,6 +227,35 @@ namespace LibGit2Sharp.Tests } [Fact] + public void CanFindInLocalConfig() + { + using (var repo = new Repository(StandardTestRepoPath)) + { + var matches = repo.Config.Find("unit"); + + Assert.NotNull(matches); + Assert.Equal(new[] { "unittests.intsetting", "unittests.longsetting" }, + matches.Select(m => m.Key).ToArray()); + } + } + + [Fact] + public void CanFindInGlobalConfig() + { + string configPath = CreateConfigurationWithDummyUser(Constants.Signature); + var options = new RepositoryOptions { GlobalConfigurationLocation = configPath }; + + using (var repo = new Repository(StandardTestRepoPath, options)) + { + var matches = repo.Config.Find(@"\.name", ConfigurationLevel.Global); + + Assert.NotNull(matches); + Assert.Equal(new[] { "user.name" }, + matches.Select(m => m.Key).ToArray()); + } + } + + [Fact] public void CanSetBooleanValue() { string path = CloneStandardTestRepo(); |