@@ -15,17 +15,26 @@ describe('OptionSplitter', () => {
15
15
output : [ '../custom/formatter' , '../formatter/output.txt' ] ,
16
16
} ,
17
17
{
18
- description : 'splits absolute unix paths' ,
18
+ description : 'splits relative windows paths' ,
19
+ input : '..\\custom\\formatter:..\\formatter\\output.txt' ,
20
+ output : [ '..\\custom\\formatter' , '..\\formatter\\output.txt' ] ,
21
+ } ,
22
+ {
23
+ description : 'splits file URLs for absolute unix path' ,
19
24
input : 'file:///custom/formatter:file:///formatter/output.txt' ,
20
25
output : [ 'file:///custom/formatter' , 'file:///formatter/output.txt' ] ,
21
26
} ,
22
27
{
23
- description : 'splits paths with quotes around them' ,
24
- input : '/custom/formatter:"/formatter directory/output.txt"' ,
25
- output : [ '/custom/formatter' , '/formatter directory/output.txt' ] ,
28
+ description : 'splits file URLs for UNC path' ,
29
+ input :
30
+ 'file://hostname/custom/formatter:file://hostname/formatter/output.txt' ,
31
+ output : [
32
+ 'file://hostname/custom/formatter' ,
33
+ 'file://hostname/formatter/output.txt' ,
34
+ ] ,
26
35
} ,
27
36
{
28
- description : 'splits absolute windows paths ' ,
37
+ description : 'splits file URLs for absolute windows path ' ,
29
38
input : 'file://C:\\custom\\formatter:file://C:\\formatter\\output.txt' ,
30
39
output : [
31
40
'file://C:\\custom\\formatter' ,
@@ -34,10 +43,141 @@ describe('OptionSplitter', () => {
34
43
} ,
35
44
{
36
45
description :
37
- 'does not split a single absolute windows paths, adds empty string' ,
46
+ 'splits file URLs for absolute windows path with "/" as directory separator' ,
47
+ input : 'file:///C:/custom/formatter:file:///C:/formatter/output.txt' ,
48
+ output : [
49
+ 'file:///C:/custom/formatter' ,
50
+ 'file:///C:/formatter/output.txt' ,
51
+ ] ,
52
+ } ,
53
+ {
54
+ description : 'splits valid file URLs for absolute windows path' ,
55
+ input : 'file:///C:\\custom\\formatter:file:///C:\\formatter\\output.txt' ,
56
+ output : [
57
+ 'file:///C:\\custom\\formatter' ,
58
+ 'file:///C:\\formatter\\output.txt' ,
59
+ ] ,
60
+ } ,
61
+ {
62
+ description :
63
+ 'splits valid file URLs for absolute windows path with "/" as directory separator' ,
64
+ input : 'file:///C:/custom/formatter:file:///C:/formatter/output.txt' ,
65
+ output : [
66
+ 'file:///C:/custom/formatter' ,
67
+ 'file:///C:/formatter/output.txt' ,
68
+ ] ,
69
+ } ,
70
+ {
71
+ description : 'splits absolute unix paths' ,
72
+ input : '/custom/formatter:/formatter/output.txt' ,
73
+ output : [ '/custom/formatter' , '/formatter/output.txt' ] ,
74
+ } ,
75
+ {
76
+ description : 'splits absolute windows paths' ,
77
+ input : 'C:\\custom\\formatter:C:\\formatter\\output.txt' ,
78
+ output : [ 'C:\\custom\\formatter' , 'C:\\formatter\\output.txt' ] ,
79
+ } ,
80
+ {
81
+ description :
82
+ 'splits absolute windows paths with "/" as directory separator' ,
83
+ input : 'C:/custom/formatter:C:/formatter/output.txt' ,
84
+ output : [ 'C:/custom/formatter' , 'C:/formatter/output.txt' ] ,
85
+ } ,
86
+ {
87
+ description : 'splits UNC paths' ,
88
+ input :
89
+ '\\\\hostname\\custom\\formatter:\\\\hostname\\formatter\\output.txt' ,
90
+ output : [
91
+ '\\\\hostname\\custom\\formatter' ,
92
+ '\\\\hostname\\formatter\\output.txt' ,
93
+ ] ,
94
+ } ,
95
+ {
96
+ description : 'splits UNC paths with "/" as directory separator' ,
97
+ input : '//hostname/custom/formatter://hostname/formatter/output.txt' ,
98
+ output : [
99
+ '//hostname/custom/formatter' ,
100
+ '//hostname/formatter/output.txt' ,
101
+ ] ,
102
+ } ,
103
+ {
104
+ description : 'splits paths with quotes around them' ,
105
+ input : '/custom/formatter:"/formatter directory/output.txt"' ,
106
+ output : [ '/custom/formatter' , '/formatter directory/output.txt' ] ,
107
+ } ,
108
+ {
109
+ description :
110
+ 'does not split a single file URL for absolute unix path, adds empty string' ,
111
+ input : 'file:///custom/formatter' ,
112
+ output : [ 'file:///custom/formatter' , '' ] ,
113
+ } ,
114
+ {
115
+ description :
116
+ 'does not split a single file URL for UNC path, adds empty string' ,
117
+ input : 'file://hostname/custom/formatter' ,
118
+ output : [ 'file://hostname/custom/formatter' , '' ] ,
119
+ } ,
120
+ {
121
+ description :
122
+ 'does not split a single file URL for absolute windows path, adds empty string' ,
38
123
input : 'file://C:\\custom\\formatter' ,
39
124
output : [ 'file://C:\\custom\\formatter' , '' ] ,
40
125
} ,
126
+ {
127
+ description :
128
+ 'does not split a single file URL for absolute windows path with "/" as directory separator, adds empty string' ,
129
+ input : 'file://C:/custom/formatter' ,
130
+ output : [ 'file://C:/custom/formatter' , '' ] ,
131
+ } ,
132
+ {
133
+ description :
134
+ 'does not split a valid single file URL for absolute windows path, adds empty string' ,
135
+ input : 'file:///C:\\custom\\formatter' ,
136
+ output : [ 'file:///C:\\custom\\formatter' , '' ] ,
137
+ } ,
138
+ {
139
+ description :
140
+ 'does not split a valid single file URL for absolute windows path with "/" as directory separator, adds empty string' ,
141
+ input : 'file:///C:/custom/formatter' ,
142
+ output : [ 'file:///C:/custom/formatter' , '' ] ,
143
+ } ,
144
+ {
145
+ description :
146
+ 'does not split a single absolute windows path, adds empty string' ,
147
+ input : 'C:\\custom\\formatter' ,
148
+ output : [ 'C:\\custom\\formatter' , '' ] ,
149
+ } ,
150
+ {
151
+ description :
152
+ 'does not split a single absolute windows path with "/" as directory separator, adds empty string' ,
153
+ input : 'C:/custom/formatter' ,
154
+ output : [ 'C:/custom/formatter' , '' ] ,
155
+ } ,
156
+ {
157
+ description : 'does not split quoted values: case 1' ,
158
+ input : '"foo:bar":"baz:qux"' ,
159
+ output : [ 'foo:bar' , 'baz:qux' ] ,
160
+ } ,
161
+ {
162
+ description : 'does not split quoted values: case 2' ,
163
+ input : '"foo:bar":baz:qux' ,
164
+ output : [ 'foo:bar' , 'baz:qux' ] ,
165
+ } ,
166
+ {
167
+ description : 'does not split quoted values: case 3' ,
168
+ input : 'foo:bar:"baz:qux"' ,
169
+ output : [ 'foo:bar' , 'baz:qux' ] ,
170
+ } ,
171
+ {
172
+ description : 'does not split quoted values: case 4' ,
173
+ input : '"foo:bar:baz:qux"' ,
174
+ output : [ 'foo:bar:baz:qux' , '' ] ,
175
+ } ,
176
+ {
177
+ description : 'splits string contains multiple ":"' ,
178
+ input : 'foo:bar:baz:qux' ,
179
+ output : [ 'foo' , 'bar:baz:qux' ] ,
180
+ } ,
41
181
]
42
182
43
183
examples . forEach ( ( { description, input, output } ) => {
0 commit comments