-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
option_splitter_spec.ts
48 lines (46 loc) · 1.54 KB
/
option_splitter_spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { describe, it } from 'mocha'
import { expect } from 'chai'
import { OptionSplitter } from './option_splitter'
describe('OptionSplitter', () => {
const examples = [
{
description: "doesn't split when nothing to split on, adds empty string",
input: '../custom/formatter',
output: ['../custom/formatter', ''],
},
{
description: 'splits relative unix paths',
input: '../custom/formatter:../formatter/output.txt',
output: ['../custom/formatter', '../formatter/output.txt'],
},
{
description: 'splits absolute unix paths',
input: 'file:///custom/formatter:file:///formatter/output.txt',
output: ['file:///custom/formatter', 'file:///formatter/output.txt'],
},
{
description: 'splits paths with quotes around them',
input: '/custom/formatter:"/formatter directory/output.txt"',
output: ['/custom/formatter', '/formatter directory/output.txt'],
},
{
description: 'splits absolute windows paths',
input: 'file://C:\\custom\\formatter:file://C:\\formatter\\output.txt',
output: [
'file://C:\\custom\\formatter',
'file://C:\\formatter\\output.txt',
],
},
{
description:
'does not split a single absolute windows paths, adds empty string',
input: 'file://C:\\custom\\formatter',
output: ['file://C:\\custom\\formatter', ''],
},
]
examples.forEach(({ description, input, output }) => {
it(description, () => {
expect(OptionSplitter.split(input)).to.eql(output)
})
})
})