@@ -6,7 +6,7 @@ namespace GitCredentialManager.Tests
6
6
{
7
7
public class WslUtilsTests
8
8
{
9
- [ PlatformTheory ( Platforms . Windows ) ]
9
+ [ Theory ]
10
10
[ InlineData ( null , false ) ]
11
11
[ InlineData ( @"" , false ) ]
12
12
[ InlineData ( @" " , false ) ]
@@ -26,6 +26,18 @@ public class WslUtilsTests
26
26
[ InlineData ( @"\\WSL$\UBUNTU\home" , true ) ]
27
27
[ InlineData ( @"\\wsl$\ubuntu\home\" , true ) ]
28
28
[ InlineData ( @"\\wsl$\openSUSE-42\home" , true ) ]
29
+ [ InlineData ( @"wsl.localhost" , false ) ]
30
+ [ InlineData ( @"\wsl.localhost\ubuntu\home" , false ) ]
31
+ [ InlineData ( @"wsl.localhost\ubuntu\home" , false ) ]
32
+ [ InlineData ( @"//wsl.localhost/ubuntu/home" , false ) ]
33
+ [ InlineData ( @"\\wsl.localhost" , false ) ]
34
+ [ InlineData ( @"\\wsl.localhost\" , false ) ]
35
+ [ InlineData ( @"\\wsl.localhost\ubuntu" , true ) ]
36
+ [ InlineData ( @"\\wsl.localhost\ubuntu\" , true ) ]
37
+ [ InlineData ( @"\\wsl.localhost\ubuntu\home" , true ) ]
38
+ [ InlineData ( @"\\WSL.LOCALHOST\UBUNTU\home" , true ) ]
39
+ [ InlineData ( @"\\wsl.localhost\ubuntu\home\" , true ) ]
40
+ [ InlineData ( @"\\wsl.localhost\openSUSE-42\home" , true ) ]
29
41
public void WslUtils_IsWslPath ( string path , bool expected )
30
42
{
31
43
bool actual = WslUtils . IsWslPath ( path ) ;
@@ -40,14 +52,21 @@ public void WslUtils_IsWslPath(string path, bool expected)
40
52
[ InlineData ( @"\\wsl$\UBUNTU\home" , "UBUNTU" , "/home" ) ]
41
53
[ InlineData ( @"\\wsl$\ubuntu\home\" , "ubuntu" , "/home/" ) ]
42
54
[ InlineData ( @"\\wsl$\openSUSE-42\home" , "openSUSE-42" , "/home" ) ]
55
+ [ InlineData ( @"\\wsl.localhost\ubuntu" , "ubuntu" , "/" ) ]
56
+ [ InlineData ( @"\\wsl.localhost\ubuntu\" , "ubuntu" , "/" ) ]
57
+ [ InlineData ( @"\\wsl.localhost\ubuntu\home" , "ubuntu" , "/home" ) ]
58
+ [ InlineData ( @"\\wsl.localhost\ubuntu\HOME" , "ubuntu" , "/HOME" ) ]
59
+ [ InlineData ( @"\\wsl.localhost\UBUNTU\home" , "UBUNTU" , "/home" ) ]
60
+ [ InlineData ( @"\\wsl.localhost\ubuntu\home\" , "ubuntu" , "/home/" ) ]
61
+ [ InlineData ( @"\\wsl.localhost\openSUSE-42\home" , "openSUSE-42" , "/home" ) ]
43
62
public void WslUtils_ConvertToDistroPath ( string path , string expectedDistro , string expectedPath )
44
63
{
45
64
string actualPath = WslUtils . ConvertToDistroPath ( path , out string actualDistro ) ;
46
65
Assert . Equal ( expectedPath , actualPath ) ;
47
66
Assert . Equal ( expectedDistro , actualDistro ) ;
48
67
}
49
68
50
- [ PlatformTheory ( Platforms . Windows ) ]
69
+ [ Theory ]
51
70
[ InlineData ( null ) ]
52
71
[ InlineData ( @"" ) ]
53
72
[ InlineData ( @" " ) ]
@@ -61,6 +80,12 @@ public void WslUtils_ConvertToDistroPath(string path, string expectedDistro, str
61
80
[ InlineData ( @"\\wsl" ) ]
62
81
[ InlineData ( @"\\wsl$" ) ]
63
82
[ InlineData ( @"\\wsl$\" ) ]
83
+ [ InlineData ( @"wsl.localhost" ) ]
84
+ [ InlineData ( @"\wsl.localhost\ubuntu\home" ) ]
85
+ [ InlineData ( @"wsl.localhost\ubuntu\home" ) ]
86
+ [ InlineData ( @"//wsl.localhost/ubuntu/home" ) ]
87
+ [ InlineData ( @"\\wsl.localhost" ) ]
88
+ [ InlineData ( @"\\wsl.localhost\" ) ]
64
89
public void WslUtils_ConvertToDistroPath_Invalid_ThrowsException ( string path )
65
90
{
66
91
Assert . Throws < ArgumentException > ( ( ) => WslUtils . ConvertToDistroPath ( path , out _ ) ) ;
0 commit comments