Skip to content
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

search repos with underscore in name #1418

Merged
merged 1 commit into from
Jul 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
29 changes: 29 additions & 0 deletions Octokit.Tests.Integration/Clients/SearchClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,35 @@ public async Task SearchForFileNameInCodeWithoutTerm()
Assert.NotEmpty(repos.Items);
}

[IntegrationTest(Skip = "As this repository has been renamed, you cannot search for it's results.")]
public async Task SearchForFileNameInCodeWithoutTerm2()
{
var request = new SearchCodeRequest()
{
FileName = "project.json",
Repos = new RepositoryCollection { "adamcaudill/Psychson" }
};


var repos = await _gitHubClient.Search.SearchCode(request);

Assert.Empty(repos.Items);
}

[IntegrationTest]
public async Task SearchForFileNameInCodeWithoutTermWithUnderscore()
{
var request = new SearchCodeRequest()
{
FileName = "readme.md",
Repos = new RepositoryCollection { "Cultural-Rogue/_51Wp.XinFengSDK.Demo" }
};

var repos = await _gitHubClient.Search.SearchCode(request);

Assert.Empty(repos.Items);
}

[IntegrationTest]
public async Task SearchForWordInCode()
{
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Helpers/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static IEnumerable<string> SplitUpperCase(this string source)
// the rule:
// Username may only contain alphanumeric characters or single hyphens
// and cannot begin or end with a hyphen
static readonly Regex nameWithOwner = new Regex("[a-z0-9.-]{1,}/[a-z0-9.-]{1,}",
static readonly Regex nameWithOwner = new Regex("[a-z0-9.-]{1,}/[a-z0-9.-_]{1,}",
#if (!PORTABLE && !NETFX_CORE)
RegexOptions.Compiled |
#endif
Expand Down