code.gitea.io/gitea@v1.21.7/web_src/js/features/repo-code.test.js (about)

     1  import {singleAnchorRegex, rangeAnchorRegex} from './repo-code.js';
     2  
     3  test('singleAnchorRegex', () => {
     4    expect(singleAnchorRegex.test('#L0')).toEqual(false);
     5    expect(singleAnchorRegex.test('#L1')).toEqual(true);
     6    expect(singleAnchorRegex.test('#L01')).toEqual(false);
     7    expect(singleAnchorRegex.test('#n0')).toEqual(false);
     8    expect(singleAnchorRegex.test('#n1')).toEqual(true);
     9    expect(singleAnchorRegex.test('#n01')).toEqual(false);
    10  });
    11  
    12  test('rangeAnchorRegex', () => {
    13    expect(rangeAnchorRegex.test('#L0-L10')).toEqual(false);
    14    expect(rangeAnchorRegex.test('#L1-L10')).toEqual(true);
    15    expect(rangeAnchorRegex.test('#L01-L10')).toEqual(false);
    16    expect(rangeAnchorRegex.test('#L1-L01')).toEqual(false);
    17  });