Skip to content

Commit 19d3e63

Browse files
committed
#68: adds more tests for ...
1 parent 15eb97a commit 19d3e63

File tree

2 files changed

+39
-9
lines changed

2 files changed

+39
-9
lines changed

test/fixtures/cases.js

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ function readPatterns (file) {
88
return fs.readFileSync(file).toString()
99
}
1010

11+
const IS_WINDOWS = process.platform === 'win32'
12+
const SHOULD_TEST_WINDOWS = IS_WINDOWS || !!process.env.IGNORE_TEST_WIN32
13+
1114
const cases = [
1215
/////////////////////////////////////////////////////////////////////
1316
// [
@@ -988,9 +991,30 @@ const cases = [
988991
]
989992
]
990993

991-
const IS_WINDOWS = process.platform === 'win32'
992-
if (!IS_WINDOWS && !process.env.IGNORE_TEST_WIN32) {
994+
if (!SHOULD_TEST_WINDOWS) {
993995
cases.push(
996+
[
997+
'#68: ignore test for files named ...',
998+
[
999+
'/...',
1000+
'/.....'
1001+
],
1002+
{
1003+
'...': 1,
1004+
'....': 0,
1005+
'.....': 1,
1006+
'......': 0
1007+
}
1008+
],
1009+
[
1010+
'#68: file named ...',
1011+
[],
1012+
{
1013+
'...': 0,
1014+
'....': 0,
1015+
'.....': 0
1016+
}
1017+
],
9941018
[
9951019
'#130: consequent escaped backslashes with whitespaces',
9961020
[
@@ -1153,7 +1177,6 @@ exports.checkEnv = key => hasOnly
11531177
: true
11541178

11551179
exports.IS_WINDOWS = IS_WINDOWS
1156-
exports.SHOULD_TEST_WINDOWS = process.env.IGNORE_TEST_WIN32
1157-
|| IS_WINDOWS
1180+
exports.SHOULD_TEST_WINDOWS = SHOULD_TEST_WINDOWS
11581181

11591182
exports.debug = debug

test/others.test.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,13 @@ _test('isPathValid', t => {
178178

179179
const IGNORE_TEST_CASES = [
180180
[
181+
// Description
181182
'test: no rule',
183+
// patterns
182184
null,
185+
// path
183186
'foo',
187+
// ignored, unignored
184188
[false, false]
185189
],
186190
[
@@ -212,14 +216,17 @@ const IGNORE_TEST_CASES = [
212216
['*.js', '!a/a.js'],
213217
'a/a.js',
214218
[false, true]
215-
],
216-
[
219+
]
220+
]
221+
222+
if (!SHOULD_TEST_WINDOWS) {
223+
IGNORE_TEST_CASES.push([
217224
`test: file which named '...'`,
218-
'foo',
225+
null,
219226
'...',
220227
[false, false]
221-
]
222-
]
228+
])
229+
}
223230

224231
IGNORE_TEST_CASES.forEach(([d, patterns, path, [ignored, unignored]]) => {
225232
_test(d, t => {

0 commit comments

Comments
 (0)