about summary refs log tree commit diff
path: root/tests/rustdoc-js/path-maxeditdistance.js
blob: 73b24a6dddf0a4fe02f1196f7d0924a2a0b0ddc5 (plain)
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
// exact-check

const EXPECTED = [
    {
        'query': 'xxxxxxxxxxx::hocuspocusprestidigitation',
        // do not match abracadabra::hocuspocusprestidigitation
        'others': [],
    },
    {
        // exact match
        'query': 'abracadabra::hocuspocusprestidigitation',
        'others': [
            { 'path': 'abracadabra', 'name': 'HocusPocusPrestidigitation' },
        ],
    },
    {
        // swap br/rb; that's edit distance 2, where maxPathEditDistance = 3 (11 / 3)
        'query': 'arbacadarba::hocuspocusprestidigitation',
        'others': [
            { 'path': 'abracadabra', 'name': 'HocusPocusPrestidigitation' },
        ],
    },
    {
        // truncate 5 chars, where maxEditDistance = 7 (21 / 3)
        'query': 'abracadarba::hocusprestidigitation',
        'others': [
            { 'path': 'abracadabra', 'name': 'HocusPocusPrestidigitation' },
        ],
    },
    {
        // truncate 9 chars, where maxEditDistance = 5 (17 / 3)
        'query': 'abracadarba::hprestidigitation',
        'others': [],
    },
];