@@ -25,12 +25,15 @@ public class TheConstructor : TestBaseClass
2525 [ TestCase ( "jane;fingerprint=9e:1a:5e:27:16:4d:2a:13:90:2c:64:41:bd:25:fd:[email protected] :github/Windows.git" , 2626 "foo.com" , "github" , "Windows" ) ]
2727 [ TestCase ( "https://[email protected] /haacked/test-mytest.git" , "bitbucket.org" , "haacked" , "test-mytest" ) ] 28- [ TestCase ( "https://git01.codeplex.com/nuget" , "git01.codeplex.com" , null , "nuget" ) ]
28+ [ TestCase ( "https://git01.codeplex.com/nuget" , "git01.codeplex.com" , "nuget" , null ,
29+ Description = "We assume the first component is the owner" ) ]
2930 [ TestCase ( "https://example.com/vpath/foo/bar" , "example.com" , "vpath" , "foo" ) ]
3031 [ TestCase ( "https://example.com/vpath/foo/bar.git" , "example.com" , "vpath" , "foo" ) ]
3132 [ TestCase ( "https://github.com/github/Windows.git?pr=24&branch=pr/23&filepath=relative/to/the/path.md" ,
3233 "github.com" , "github" , "Windows" ) ]
3334 [ TestCase ( "https://github.com/github/VisualStudio/blob/master/src/code.cs" , "github.com" , "github" , "VisualStudio" ) ]
35+ [ TestCase ( "https://github.com/github" , "github.com" , "github" , null ) ]
36+ [ TestCase ( "https://github.com" , "github.com" , null , null ) ]
3437 public void ParsesWellFormedUrlComponents ( string url , string expectedHost , string owner , string repositoryName )
3538 {
3639 var cloneUrl = new UriString ( url ) ;
@@ -71,13 +74,17 @@ public void ParsesLocalFileUris(string path)
7174 [ TestCase ( "http://example.com" , "example.com" , null , null ) ]
7275 [ TestCase ( "http://example.com?bar" , "example.com" , null , null ) ]
7376 [ TestCase ( "https://example.com?bar" , "example.com" , null , null ) ]
74- [ TestCase ( "ssh://[email protected] /Windows.git" , "example.com" , null , "Windows" ) ] 77+ [ TestCase ( "ssh://[email protected] /Windows.git" , "example.com" , "Windows.git" , null , 78+ Description = "We assume the first component is the owner even if it ends with .git" ) ]
7579 [ TestCase ( "[email protected] :/" , "bar.com" , null , null ) ] 7680 [ TestCase ( "[email protected] /" , "bar.com" , null , null ) ] 7781 [ TestCase ( "[email protected] " , "bar.com" , null , null ) ] 7882 [ TestCase ( "[email protected] :/Windows.git" , "bar.com" , null , "Windows" ) ] 7983 [ TestCase ( "[email protected] /Windows.git" , "baz.com" , null , "Windows" ) ] 8084 [ TestCase ( "ssh://[email protected] :github/Windows.git" , "github.com" , "github" , "Windows" ) ] 85+
86+ // NOTE: Used by LocalRepositoryModelTests.GenerateUrl but I don't think it's a legal URL
87+ [ TestCase ( "[email protected] /foo/bar" , "github.com" , null , "foo/bar" ) ] 8188 public void ParsesWeirdUrlsAsWellAsPossible ( string url , string expectedHost , string owner , string repositoryName )
8289 {
8390 var cloneUrl = new UriString ( url ) ;
@@ -202,21 +209,6 @@ public void ConvertsWithNewOwner(string uriString, string expected, string owner
202209 [ TestCase ( "[email protected] :org/repo.git" , "https://example.com/org/repo" ) ] 203210 [ TestCase ( "ssh://[email protected] :443/shana/cef" , "https://github.com/shana/cef" ) ] 204211 [ TestCase ( "ssh://[email protected] :23/haacked/encourage" , "https://example.com:23/haacked/encourage" ) ] 205-
206- [ TestCase ( "asdf" , null ) ]
207- [ TestCase ( "" , null ) ]
208- [ TestCase ( "file:///C:/dev/exp/foo" , "file:///C:/dev/exp/foo" ) ]
209- [ TestCase ( "http://example.com/" , "http://example.com/" ) ]
210- [ TestCase ( "http://[email protected] /foo/bar" , "http://example.com/foo/bar" ) ] 211- [ TestCase ( "https://github.com/github/Windows" , "https://github.com/github/Windows" ) ]
212- [ TestCase ( "https://github.com/github/Windows.git" , "https://github.com/github/Windows" ) ]
213- [ TestCase ( "https://[email protected] /github/Windows.git" , "https://github.com/github/Windows" ) ] 214- [ TestCase ( "http://example.com:4000/github/Windows" , "http://example.com:4000/github/Windows" ) ]
215- [ TestCase ( "[email protected] :github/Windows.git" , "https://192.168.1.2/github/Windows" ) ] 216- [ TestCase ( "[email protected] :org/repo.git" , "https://example.com/org/repo" ) ] 217- [ TestCase ( "ssh://[email protected] :443/shana/cef" , "https://github.com/shana/cef" ) ] 218- [ TestCase ( "ssh://[email protected] :23/haacked/encourage" , "https://example.com:23/haacked/encourage" ) ] 219-
220212 public void ShouldNeverThrow ( string url , string expected )
221213 {
222214 Uri uri ;
0 commit comments