You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugins/amazonq/shared/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/amazonq/lsp/util/FileUriUtilTest.kt
+29-8Lines changed: 29 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -19,39 +19,57 @@ class FileUriUtilTest : BasePlatformTestCase() {
19
19
every { this@mockk.isDirectory } returns isDirectory
20
20
}
21
21
22
+
privatefunnormalizeFileUri(uri:String) : String {
23
+
if (!System.getProperty("os.name").lowercase().contains("windows")) {
24
+
return uri
25
+
}
26
+
27
+
if (!uri.startsWith("file:///")) {
28
+
return uri
29
+
}
30
+
31
+
val path = uri.substringAfter("file:///")
32
+
return"file:///C:/$path"
33
+
}
34
+
22
35
@Test
23
36
fun`test basic unix path`() {
24
37
val virtualFile = createMockVirtualFile("/path/to/file.txt")
25
38
val uri =FileUriUtil.toUriString(virtualFile)
26
-
assertEquals("file:///path/to/file.txt", uri)
39
+
val expected = normalizeFileUri("file:///path/to/file.txt")
40
+
assertEquals(expected, uri)
27
41
}
28
42
29
43
@Test
30
44
fun`test unix directory path`() {
31
45
val virtualFile = createMockVirtualFile("/path/to/directory/", isDirectory =true)
32
46
val uri =FileUriUtil.toUriString(virtualFile)
33
-
assertEquals("file:///path/to/directory", uri)
47
+
val expected = normalizeFileUri("file:///path/to/directory")
48
+
assertEquals(expected, uri)
34
49
}
35
50
36
51
@Test
37
52
fun`test path with spaces`() {
38
53
val virtualFile = createMockVirtualFile("/path/with spaces/file.txt")
0 commit comments