<commit_before>"use strict";

describe('pathMatcher', function () {
    
    var matcher = require('../lib/pathMatcher');
    
    it("test matches", function () {
        var test = matcher.create('/', ['c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['a/b/c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['c.*']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['**/c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['*/*/c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['*/c.txt']);
        expect(test('/a/b/c.txt')).toBe(false);
        
        test = matcher.create('/', ['*/?/c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['*/??/c.txt']);
        expect(test('/a/b/c.txt')).toBe(false);
    });
    
    it("test absolute matches", function () {
        var test = matcher.create('/', ['/a']);
        expect(test('/a')).toBe(true);
        expect(test('/a/b')).toBe(false);
        expect(test('/b/a')).toBe(false);
        
        test = matcher.create('/', ['/a/b/c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['/a/**/c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
    });
    
    it("test multiple masks", function () {
        var test = matcher.create('/', ['a/**', '*.txt']);
        expect(test('/a/b/c')).toBe(true); // should match mask 1
        expect(test('/x/y/z.txt')).toBe(true); // should match mask 2
    });
    
    it("backslashes as separators", function () {
        var test = matcher.create('/', ['a\\b']);
        expect(test('/a/b')).toBe(true);
        expect(test('\\a\\b')).toBe(true);
        
        test = matcher.create('\\', ['a/**/b']);
        expect(test('/a/x/b')).toBe(true);
        expect(test('\\a\\x\\b')).toBe(true);
    });
    
    it("test reference directory", function () {
        var test = matcher.create('/', ['a/**']);
        expect(test('/a/b/c')).toBe(true);
        
        test = matcher.create('/a', ['a/**']);
        expect(test('/a/b/c')).toBe(false);
        
        test = matcher.create('/a', ['b/**']);
        expect(test('/a/b/c')).toBe(true);
    });
    
    it("characters #! should have no special meaning", function () {<commit_msg>removed win-specyfic test, which will not work on nix<commit_after>"use strict";

describe('pathMatcher', function () {
    
    var matcher = require('../lib/pathMatcher');
    
    it("test matches", function () {
        var test = matcher.create('/', ['c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['a/b/c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['c.*']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['**/c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['*/*/c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['*/c.txt']);
        expect(test('/a/b/c.txt')).toBe(false);
        
        test = matcher.create('/', ['*/?/c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['*/??/c.txt']);
        expect(test('/a/b/c.txt')).toBe(false);
    });
    
    it("test absolute matches", function () {
        var test = matcher.create('/', ['/a']);
        expect(test('/a')).toBe(true);
        expect(test('/a/b')).toBe(false);
        expect(test('/b/a')).toBe(false);
        
        test = matcher.create('/', ['/a/b/c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
        
        test = matcher.create('/', ['/a/**/c.txt']);
        expect(test('/a/b/c.txt')).toBe(true);
    });
    
    it("test multiple masks", function () {
        var test = matcher.create('/', ['a/**', '*.txt']);
        expect(test('/a/b/c')).toBe(true); // should match mask 1
        expect(test('/x/y/z.txt')).toBe(true); // should match mask 2
    });
    
    it("test reference directory", function () {
        var test = matcher.create('/', ['a/**']);
        expect(test('/a/b/c')).toBe(true);
        
        test = matcher.create('/a', ['a/**']);
        expect(test('/a/b/c')).toBe(false);
        
        test = matcher.create('/a', ['b/**']);
        expect(test('/a/b/c')).toBe(true);
    });
    
    it("characters #! should have no special meaning", function () {
{'fraction_non_alphanumeric': 0.2641912078531797, 'fraction_numerical': 0.0008536064874093043, 'mean_word_length': 1.9815521628498727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5685829', 'n_tokens_mistral': 1545, 'n_tokens_neox': 1584, 'n_words': 233}