search.test.ts 16.9 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5 6 7 8 9 10
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

'use strict';

import path = require('path');
import assert = require('assert');

11
import * as glob from 'vs/base/common/glob';
B
Benjamin Pasero 已提交
12
import {join, normalize} from 'vs/base/common/paths';
13
import * as platform from 'vs/base/common/platform';
E
Erich Gamma 已提交
14 15 16
import {LineMatch} from 'vs/platform/search/common/search';

import {FileWalker, Engine as FileSearchEngine} from 'vs/workbench/services/search/node/fileSearch';
17
import {IRawFileMatch} from 'vs/workbench/services/search/node/search';
E
Erich Gamma 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
import {Engine as TextSearchEngine} from 'vs/workbench/services/search/node/textSearch';

function count(lineMatches: LineMatch[]): number {
	let count = 0;
	if (lineMatches) {
		for (let i = 0; i < lineMatches.length; i++) {
			let line = lineMatches[i];
			let wordMatches = line.offsetAndLengths;
			count += wordMatches.length;
		}
	}

	return count;
}

33
function rootfolders() {
B
Benjamin Pasero 已提交
34 35 36
	return [path.normalize(require.toUrl('./fixtures'))];
}

E
Erich Gamma 已提交
37 38
suite('Search', () => {

B
Benjamin Pasero 已提交
39
	test('Files: *.js', function (done: () => void) {
E
Erich Gamma 已提交
40
		let engine = new FileSearchEngine({
41
			rootFolders: rootfolders(),
42
			filePattern: '*.js'
E
Erich Gamma 已提交
43 44 45 46 47 48 49 50 51 52 53 54 55 56
		});

		let count = 0;
		engine.search((result) => {
			if (result) {
				count++;
			}
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 4);
			done();
		});
	});

B
Benjamin Pasero 已提交
57
	test('Files: examples/com*', function (done: () => void) {
58
		let engine = new FileSearchEngine({
59
			rootFolders: rootfolders(),
B
Benjamin Pasero 已提交
60
			filePattern: normalize(join('examples', 'com*'), true)
61 62 63 64 65 66 67 68 69 70 71 72 73 74
		});

		let count = 0;
		engine.search((result) => {
			if (result) {
				count++;
			}
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 1);
			done();
		});
	});

B
Benjamin Pasero 已提交
75
	test('Files: examples (fuzzy)', function (done: () => void) {
76
		let engine = new FileSearchEngine({
77
			rootFolders: rootfolders(),
78
			filePattern: 'xl'
79 80 81 82 83 84 85 86 87
		});

		let count = 0;
		engine.search((result) => {
			if (result) {
				count++;
			}
		}, () => { }, (error) => {
			assert.ok(!error);
B
Benjamin Pasero 已提交
88
			assert.equal(count, 6);
89 90 91 92
			done();
		});
	});

B
Benjamin Pasero 已提交
93
	test('Files: NPE (CamelCase)', function (done: () => void) {
E
Erich Gamma 已提交
94
		let engine = new FileSearchEngine({
95
			rootFolders: rootfolders(),
96
			filePattern: 'NullPE'
E
Erich Gamma 已提交
97 98 99 100 101 102 103 104 105 106 107 108 109 110
		});

		let count = 0;
		engine.search((result) => {
			if (result) {
				count++;
			}
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 1);
			done();
		});
	});

B
Benjamin Pasero 已提交
111
	test('Files: *.*', function (done: () => void) {
E
Erich Gamma 已提交
112
		let engine = new FileSearchEngine({
113
			rootFolders: rootfolders(),
114
			filePattern: '*.*'
E
Erich Gamma 已提交
115 116 117 118 119 120 121 122 123
		});

		let count = 0;
		engine.search((result) => {
			if (result) {
				count++;
			}
		}, () => { }, (error) => {
			assert.ok(!error);
124
			assert.equal(count, 13);
E
Erich Gamma 已提交
125 126 127 128
			done();
		});
	});

B
Benjamin Pasero 已提交
129
	test('Files: *.as', function (done: () => void) {
E
Erich Gamma 已提交
130
		let engine = new FileSearchEngine({
131
			rootFolders: rootfolders(),
132
			filePattern: '*.as'
E
Erich Gamma 已提交
133 134 135 136 137 138 139 140 141 142 143 144 145 146
		});

		let count = 0;
		engine.search((result) => {
			if (result) {
				count++;
			}
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 0);
			done();
		});
	});

B
Benjamin Pasero 已提交
147
	test('Files: *.* without derived', function (done: () => void) {
B
Benjamin Pasero 已提交
148
		let engine = new FileSearchEngine({
149
			rootFolders: rootfolders(),
B
Benjamin Pasero 已提交
150
			filePattern: 'site.*',
B
Benjamin Pasero 已提交
151
			excludePattern: { '**/*.css': { 'when': '$(basename).less' } }
B
Benjamin Pasero 已提交
152 153 154
		});

		let count = 0;
155
		let res: IRawFileMatch;
B
Benjamin Pasero 已提交
156 157 158 159 160 161 162 163
		engine.search((result) => {
			if (result) {
				count++;
			}
			res = result;
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 1);
164
			assert.strictEqual(path.basename(res.relativePath), 'site.less');
B
Benjamin Pasero 已提交
165 166 167 168
			done();
		});
	});

B
Benjamin Pasero 已提交
169
	test('Files: *.* exclude folder without wildcard', function (done: () => void) {
B
Benjamin Pasero 已提交
170
		let engine = new FileSearchEngine({
171
			rootFolders: rootfolders(),
B
Benjamin Pasero 已提交
172
			filePattern: '*.*',
B
Benjamin Pasero 已提交
173
			excludePattern: { 'examples': true }
B
Benjamin Pasero 已提交
174 175 176 177 178 179 180 181 182
		});

		let count = 0;
		engine.search((result) => {
			if (result) {
				count++;
			}
		}, () => { }, (error) => {
			assert.ok(!error);
183
			assert.equal(count, 8);
B
Benjamin Pasero 已提交
184 185 186 187
			done();
		});
	});

B
Benjamin Pasero 已提交
188
	test('Files: *.* exclude folder with leading wildcard', function (done: () => void) {
B
Benjamin Pasero 已提交
189
		let engine = new FileSearchEngine({
190
			rootFolders: rootfolders(),
B
Benjamin Pasero 已提交
191
			filePattern: '*.*',
B
Benjamin Pasero 已提交
192
			excludePattern: { '**/examples': true }
B
Benjamin Pasero 已提交
193 194 195 196 197 198 199 200 201
		});

		let count = 0;
		engine.search((result) => {
			if (result) {
				count++;
			}
		}, () => { }, (error) => {
			assert.ok(!error);
202
			assert.equal(count, 8);
B
Benjamin Pasero 已提交
203 204 205 206
			done();
		});
	});

B
Benjamin Pasero 已提交
207
	test('Files: *.* exclude folder with trailing wildcard', function (done: () => void) {
B
Benjamin Pasero 已提交
208
		let engine = new FileSearchEngine({
209
			rootFolders: rootfolders(),
B
Benjamin Pasero 已提交
210
			filePattern: '*.*',
B
Benjamin Pasero 已提交
211
			excludePattern: { 'examples/**': true }
B
Benjamin Pasero 已提交
212 213 214 215 216 217 218 219 220
		});

		let count = 0;
		engine.search((result) => {
			if (result) {
				count++;
			}
		}, () => { }, (error) => {
			assert.ok(!error);
221
			assert.equal(count, 8);
222 223 224 225
			done();
		});
	});

B
Benjamin Pasero 已提交
226
	test('Files: *.* exclude with unicode', function (done: () => void) {
227
		let engine = new FileSearchEngine({
228
			rootFolders: rootfolders(),
229
			filePattern: '*.*',
B
Benjamin Pasero 已提交
230
			excludePattern: { '**/üm laut汉语': true }
231 232 233 234 235 236 237 238 239
		});

		let count = 0;
		engine.search((result) => {
			if (result) {
				count++;
			}
		}, () => { }, (error) => {
			assert.ok(!error);
240
			assert.equal(count, 12);
241 242 243 244
			done();
		});
	});

B
Benjamin Pasero 已提交
245
	test('Files: Unicode and Spaces', function (done: () => void) {
246
		let engine = new FileSearchEngine({
247
			rootFolders: rootfolders(),
248 249 250 251
			filePattern: '汉语'
		});

		let count = 0;
252
		let res: IRawFileMatch;
253 254 255 256 257 258 259 260
		engine.search((result) => {
			if (result) {
				count++;
			}
			res = result;
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 1);
261
			assert.equal(path.basename(res.relativePath), '汉语.txt');
B
Benjamin Pasero 已提交
262 263 264 265
			done();
		});
	});

B
Benjamin Pasero 已提交
266
	test('Files: no results', function (done: () => void) {
267
		let engine = new FileSearchEngine({
268
			rootFolders: rootfolders(),
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
			filePattern: 'nofilematch'
		});

		let count = 0;
		engine.search((result) => {
			if (result) {
				count++;
			}
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 0);
			done();
		});
	});

B
Benjamin Pasero 已提交
284
	test('Files: absolute path to file ignores excludes', function (done: () => void) {
285
		let engine = new FileSearchEngine({
286
			rootFolders: rootfolders(),
287
			filePattern: path.normalize(path.join(require.toUrl('./fixtures'), 'site.css')),
B
Benjamin Pasero 已提交
288
			excludePattern: { '**/*.css': true }
289 290 291
		});

		let count = 0;
292
		let res: IRawFileMatch;
293 294 295 296 297 298 299 300
		engine.search((result) => {
			if (result) {
				count++;
			}
			res = result;
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 1);
301
			assert.equal(path.basename(res.relativePath), 'site.css');
302 303 304 305
			done();
		});
	});

C
Christof Marti 已提交
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321
	test('Files: relative path matched once', function (done: () => void) {
		let engine = new FileSearchEngine({
			rootFolders: rootfolders(),
			filePattern: path.normalize(path.join('examples', 'company.js'))
		});

		let count = 0;
		let res: IRawFileMatch;
		engine.search((result) => {
			if (result) {
				count++;
			}
			res = result;
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 1);
322
			assert.equal(path.basename(res.relativePath), 'company.js');
C
Christof Marti 已提交
323 324 325 326
			done();
		});
	});

B
Benjamin Pasero 已提交
327
	test('Files: relative path to file ignores excludes', function (done: () => void) {
328
		let engine = new FileSearchEngine({
329
			rootFolders: rootfolders(),
330
			filePattern: path.normalize(path.join('examples', 'company.js')),
B
Benjamin Pasero 已提交
331
			excludePattern: { '**/*.js': true }
332 333 334
		});

		let count = 0;
335
		let res: IRawFileMatch;
336 337 338 339 340 341 342 343
		engine.search((result) => {
			if (result) {
				count++;
			}
			res = result;
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 1);
344
			assert.equal(path.basename(res.relativePath), 'company.js');
345 346 347 348
			done();
		});
	});

B
Benjamin Pasero 已提交
349
	test('Files: extraFiles only', function (done: () => void) {
350
		let engine = new FileSearchEngine({
351 352
			rootFolders: [],
			extraFiles: [
353 354 355 356 357 358 359 360
				path.normalize(path.join(require.toUrl('./fixtures'), 'site.css')),
				path.normalize(path.join(require.toUrl('./fixtures'), 'examples', 'company.js')),
				path.normalize(path.join(require.toUrl('./fixtures'), 'index.html'))
			],
			filePattern: '*.js'
		});

		let count = 0;
361
		let res: IRawFileMatch;
362 363 364 365 366 367 368 369
		engine.search((result) => {
			if (result) {
				count++;
			}
			res = result;
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 1);
370
			assert.equal(path.basename(res.relativePath), 'company.js');
371 372 373 374
			done();
		});
	});

B
Benjamin Pasero 已提交
375
	test('Files: extraFiles only (with include)', function (done: () => void) {
376
		let engine = new FileSearchEngine({
377 378
			rootFolders: [],
			extraFiles: [
379 380 381 382 383 384 385 386 387
				path.normalize(path.join(require.toUrl('./fixtures'), 'site.css')),
				path.normalize(path.join(require.toUrl('./fixtures'), 'examples', 'company.js')),
				path.normalize(path.join(require.toUrl('./fixtures'), 'index.html'))
			],
			filePattern: '*.*',
			includePattern: { '**/*.css': true }
		});

		let count = 0;
388
		let res: IRawFileMatch;
389 390 391 392 393 394 395 396
		engine.search((result) => {
			if (result) {
				count++;
			}
			res = result;
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 1);
397
			assert.equal(path.basename(res.relativePath), 'site.css');
398 399 400 401
			done();
		});
	});

B
Benjamin Pasero 已提交
402
	test('Files: extraFiles only (with exclude)', function (done: () => void) {
403
		let engine = new FileSearchEngine({
404 405
			rootFolders: [],
			extraFiles: [
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
				path.normalize(path.join(require.toUrl('./fixtures'), 'site.css')),
				path.normalize(path.join(require.toUrl('./fixtures'), 'examples', 'company.js')),
				path.normalize(path.join(require.toUrl('./fixtures'), 'index.html'))
			],
			filePattern: '*.*',
			excludePattern: { '**/*.css': true }
		});

		let count = 0;
		engine.search((result) => {
			if (result) {
				count++;
			}
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 2);
			done();
		});
	});

426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478
	test('Find: exclude subfolder', function (done: () => void) {
		if (platform.isWindows) {
			return;
		}

		const walker = new FileWalker({ rootFolders: rootfolders() });
		const file0 = './more/file.txt';
		const file1 = './examples/subfolder/subfile.txt';

		const cmd1 = walker.spawnFindCmd(rootfolders()[0], glob.parse({ '**/something': true }));
		walker.readStdout(cmd1, 'utf8', (err1, stdout1) => {
			assert.equal(err1, null);
			assert.notStrictEqual(stdout1.split('\n').indexOf(file0), -1, stdout1);
			assert.notStrictEqual(stdout1.split('\n').indexOf(file1), -1, stdout1);

			const cmd2 = walker.spawnFindCmd(rootfolders()[0], glob.parse({ '**/subfolder': true }));
			walker.readStdout(cmd2, 'utf8', (err2, stdout2) => {
				assert.equal(err2, null);
				assert.notStrictEqual(stdout1.split('\n').indexOf(file0), -1, stdout1);
				assert.strictEqual(stdout2.split('\n').indexOf(file1), -1, stdout2);
				done();
			});
		});
	});

	test('Find: exclude multiple folders', function (done: () => void) {
		if (platform.isWindows) {
			return;
		}

		const walker = new FileWalker({ rootFolders: rootfolders() });
		const file0 = './index.html';
		const file1 = './examples/small.js';
		const file2 = './more/file.txt';

		const cmd1 = walker.spawnFindCmd(rootfolders()[0], glob.parse({ '**/something': true }));
		walker.readStdout(cmd1, 'utf8', (err1, stdout1) => {
			assert.equal(err1, null);
			assert.notStrictEqual(stdout1.split('\n').indexOf(file0), -1, stdout1);
			assert.notStrictEqual(stdout1.split('\n').indexOf(file1), -1, stdout1);
			assert.notStrictEqual(stdout1.split('\n').indexOf(file2), -1, stdout1);

			const cmd2 = walker.spawnFindCmd(rootfolders()[0], glob.parse({ '{**/examples,**/more}': true }));
			walker.readStdout(cmd2, 'utf8', (err2, stdout2) => {
				assert.equal(err2, null);
				assert.notStrictEqual(stdout1.split('\n').indexOf(file0), -1, stdout1);
				assert.strictEqual(stdout2.split('\n').indexOf(file1), -1, stdout2);
				assert.strictEqual(stdout2.split('\n').indexOf(file2), -1, stdout2);
				done();
			});
		});
	});

B
Benjamin Pasero 已提交
479
	test('Text: GameOfLife', function (done: () => void) {
E
Erich Gamma 已提交
480 481
		let c = 0;
		let config = {
482
			rootFolders: rootfolders(),
483
			filePattern: '*.js',
E
Erich Gamma 已提交
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499
			contentPattern: { pattern: 'GameOfLife', modifiers: 'i' }
		};

		let engine = new TextSearchEngine(config, new FileWalker(config));

		engine.search((result) => {
			if (result && result.lineMatches) {
				c += count(result.lineMatches);
			}
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(c, 4);
			done();
		});
	});

B
Benjamin Pasero 已提交
500
	test('Text: GameOfLife (RegExp)', function (done: () => void) {
E
Erich Gamma 已提交
501 502
		let c = 0;
		let config = {
503
			rootFolders: rootfolders(),
504
			filePattern: '*.js',
E
Erich Gamma 已提交
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520
			contentPattern: { pattern: 'Game.?fL\\w?fe', isRegExp: true }
		};

		let engine = new TextSearchEngine(config, new FileWalker(config));

		engine.search((result) => {
			if (result && result.lineMatches) {
				c += count(result.lineMatches);
			}
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(c, 4);
			done();
		});
	});

B
Benjamin Pasero 已提交
521
	test('Text: GameOfLife (Word Match, Case Sensitive)', function (done: () => void) {
E
Erich Gamma 已提交
522 523
		let c = 0;
		let config = {
524
			rootFolders: rootfolders(),
525
			filePattern: '*.js',
E
Erich Gamma 已提交
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541
			contentPattern: { pattern: 'GameOfLife', isWordMatch: true, isCaseSensitive: true }
		};

		let engine = new TextSearchEngine(config, new FileWalker(config));

		engine.search((result) => {
			if (result && result.lineMatches) {
				c += count(result.lineMatches);
			}
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(c, 4);
			done();
		});
	});

B
Benjamin Pasero 已提交
542
	test('Text: Helvetica (UTF 16)', function (done: () => void) {
E
Erich Gamma 已提交
543 544
		let c = 0;
		let config = {
545
			rootFolders: rootfolders(),
546
			filePattern: '*.css',
E
Erich Gamma 已提交
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562
			contentPattern: { pattern: 'Helvetica', modifiers: 'i' }
		};

		let engine = new TextSearchEngine(config, new FileWalker(config));

		engine.search((result) => {
			if (result && result.lineMatches) {
				c += count(result.lineMatches);
			}
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(c, 2);
			done();
		});
	});

B
Benjamin Pasero 已提交
563
	test('Text: e', function (done: () => void) {
E
Erich Gamma 已提交
564 565
		let c = 0;
		let config = {
566
			rootFolders: rootfolders(),
567
			filePattern: '*.*',
E
Erich Gamma 已提交
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583
			contentPattern: { pattern: 'e', modifiers: 'i' }
		};

		let engine = new TextSearchEngine(config, new FileWalker(config));

		engine.search((result) => {
			if (result && result.lineMatches) {
				c += count(result.lineMatches);
			}
		}, (result) => { }, (error) => {
			assert.ok(!error);
			assert.equal(c, 748);
			done();
		});
	});

B
Benjamin Pasero 已提交
584
	test('Text: e (with excludes)', function (done: () => void) {
E
Erich Gamma 已提交
585
		let c = 0;
586
		let config: any = {
587
			rootFolders: rootfolders(),
588
			filePattern: '*.*',
E
Erich Gamma 已提交
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
			contentPattern: { pattern: 'e', modifiers: 'i' },
			excludePattern: { '**/examples': true }
		};

		let engine = new TextSearchEngine(config, new FileWalker(config));

		engine.search((result) => {
			if (result && result.lineMatches) {
				c += count(result.lineMatches);
			}
		}, (result) => { }, (error) => {
			assert.ok(!error);
			assert.equal(c, 366);
			done();
		});
	});

B
Benjamin Pasero 已提交
606
	test('Text: e (with includes)', function (done: () => void) {
E
Erich Gamma 已提交
607
		let c = 0;
608
		let config: any = {
609
			rootFolders: rootfolders(),
610
			filePattern: '*.*',
E
Erich Gamma 已提交
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627
			contentPattern: { pattern: 'e', modifiers: 'i' },
			includePattern: { '**/examples/**': true }
		};

		let engine = new TextSearchEngine(config, new FileWalker(config));

		engine.search((result) => {
			if (result && result.lineMatches) {
				c += count(result.lineMatches);
			}
		}, (result) => { }, (error) => {
			assert.ok(!error);
			assert.equal(c, 382);
			done();
		});
	});

B
Benjamin Pasero 已提交
628
	test('Text: e (with includes and exclude)', function (done: () => void) {
E
Erich Gamma 已提交
629
		let c = 0;
630
		let config: any = {
631
			rootFolders: rootfolders(),
632
			filePattern: '*.*',
E
Erich Gamma 已提交
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650
			contentPattern: { pattern: 'e', modifiers: 'i' },
			includePattern: { '**/examples/**': true },
			excludePattern: { '**/examples/small.js': true }
		};

		let engine = new TextSearchEngine(config, new FileWalker(config));

		engine.search((result) => {
			if (result && result.lineMatches) {
				c += count(result.lineMatches);
			}
		}, (result) => { }, (error) => {
			assert.ok(!error);
			assert.equal(c, 361);
			done();
		});
	});

B
Benjamin Pasero 已提交
651
	test('Text: a (capped)', function (done: () => void) {
E
Erich Gamma 已提交
652 653
		let c = 0;
		let config = {
654
			rootFolders: rootfolders(),
655
			filePattern: '*.*',
E
Erich Gamma 已提交
656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672
			contentPattern: { pattern: 'a', modifiers: 'i' },
			maxResults: 520
		};

		let engine = new TextSearchEngine(config, new FileWalker(config));

		engine.search((result) => {
			if (result && result.lineMatches) {
				c += count(result.lineMatches);
			}
		}, (result) => { }, (error) => {
			assert.ok(!error);
			assert.equal(c, 520);
			done();
		});
	});

B
Benjamin Pasero 已提交
673
	test('Text: a (no results)', function (done: () => void) {
E
Erich Gamma 已提交
674 675
		let c = 0;
		let config = {
676
			rootFolders: rootfolders(),
677
			filePattern: '*.*',
E
Erich Gamma 已提交
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693
			contentPattern: { pattern: 'ahsogehtdas', modifiers: 'i' }
		};

		let engine = new TextSearchEngine(config, new FileWalker(config));

		engine.search((result) => {
			if (result && result.lineMatches) {
				c += count(result.lineMatches);
			}
		}, (result) => { }, (error) => {
			assert.ok(!error);
			assert.equal(c, 0);
			done();
		});
	});
});