@@ -25,6 +25,18 @@ describe("Convert", () => {
25
25
} )
26
26
27
27
describe ( "pathToUri" , ( ) => {
28
+ it ( "does not convert path other than file:" , ( ) => {
29
+ expect ( Convert . pathToUri ( "http://atom.io/a" ) ) . toBe ( "http://atom.io/a" )
30
+ expect ( Convert . pathToUri ( "https://atom.io/b" ) ) . toBe ( "https://atom.io/b" )
31
+ expect ( Convert . pathToUri ( "deno:/hello.js" ) ) . toBe ( "deno:/hello.js" )
32
+ } )
33
+
34
+ it ( "does not convert non-alphanumeric path other than file:" , ( ) => {
35
+ expect ( Convert . pathToUri ( "http://atom.io/a%40%E3%81%82" ) ) . toBe ( "http://atom.io/a%40%E3%81%82" )
36
+ expect ( Convert . pathToUri ( "https://atom.io/b?foo=bar" ) ) . toBe ( "https://atom.io/b?foo=bar" )
37
+ expect ( Convert . pathToUri ( "deno:/hello%40%E3%81%82.js" ) ) . toBe ( "deno:/hello%40%E3%81%82.js" )
38
+ } )
39
+
28
40
it ( "prefixes an absolute path with file://" , ( ) => {
29
41
expect ( Convert . pathToUri ( "/a/b/c/d.txt" ) ) . toBe ( "file:///a/b/c/d.txt" )
30
42
} )
@@ -38,6 +50,11 @@ describe("Convert", () => {
38
50
} )
39
51
40
52
it ( "does not encode Windows drive specifiers" , ( ) => {
53
+ // This test only succeeds on windows. (Because of the difference in the processing method of drive characters)
54
+ // However, it is enough to test the windows drive character only on windows.
55
+ if ( process . platform !== "win32" ) {
56
+ pending ( "Only test on windows" )
57
+ }
41
58
expect ( Convert . pathToUri ( "d:\\ee\\ff.txt" ) ) . toBe ( "file:///d:/ee/ff.txt" )
42
59
} )
43
60
@@ -47,10 +64,18 @@ describe("Convert", () => {
47
64
} )
48
65
49
66
describe ( "uriToPath" , ( ) => {
50
- it ( "does not convert http: and https: uri's " , ( ) => {
67
+ it ( "does not convert uri other than file: " , ( ) => {
51
68
setProcessPlatform ( "darwin" )
52
69
expect ( Convert . uriToPath ( "http://atom.io/a" ) ) . toBe ( "http://atom.io/a" )
53
70
expect ( Convert . uriToPath ( "https://atom.io/b" ) ) . toBe ( "https://atom.io/b" )
71
+ expect ( Convert . uriToPath ( "deno:/hello.js" ) ) . toBe ( "deno:/hello.js" )
72
+ } )
73
+
74
+ it ( "does not convert non-alphanumeric uri other than file:" , ( ) => {
75
+ setProcessPlatform ( "darwin" )
76
+ expect ( Convert . uriToPath ( "http://atom.io/a%40%E3%81%82" ) ) . toBe ( "http://atom.io/a%40%E3%81%82" )
77
+ expect ( Convert . uriToPath ( "https://atom.io/b?foo=bar" ) ) . toBe ( "https://atom.io/b?foo=bar" )
78
+ expect ( Convert . uriToPath ( "deno:/hello%40%E3%81%82.js" ) ) . toBe ( "deno:/hello%40%E3%81%82.js" )
54
79
} )
55
80
56
81
it ( "converts a file:// path to an absolute path" , ( ) => {
0 commit comments