tests/rustdoc-js/non-english-identifier.js JAVASCRIPT 179 lines View on github.com → Search inside
1const PARSED = [2    {3        query: '中文',4        elems: [{5            name: "中文",6            fullPath: ["中文"],7            pathWithoutLast: [],8            pathLast: "中文",9            generics: [],10            typeFilter: null,11        }],12        returned: [],13        foundElems: 1,14        userQuery: "中文",15        error: null,16    },17    {18        query: '_0Mixed中英文',19        elems: [{20            name: "_0Mixed中英文",21            fullPath: ["_0mixed中英文"],22            pathWithoutLast: [],23            pathLast: "_0mixed中英文",24            normalizedPathLast: "0mixed中英文",25            generics: [],26            typeFilter: null,27        }],28        foundElems: 1,29        userQuery: "_0Mixed中英文",30        returned: [],31        error: null,32    },33    {34        query: 'my_crate::中文API',35        elems: [{36            name: "my_crate::中文API",37            fullPath: ["my_crate", "中文api"],38            pathWithoutLast: ["my_crate"],39            pathLast: "中文api",40            generics: [],41            typeFilter: null,42        }],43        foundElems: 1,44        userQuery: "my_crate::中文API",45        returned: [],46        error: null,47    },48    {49        query: '类型A,类型B<约束C>->返回类型<关联类型=路径::约束D>',50        elems: [{51            name: "类型A",52            fullPath: ["类型a"],53            pathWithoutLast: [],54            pathLast: "类型a",55            generics: [],56        }, {57            name: "类型B",58            fullPath: ["类型b"],59            pathWithoutLast: [],60            pathLast: "类型b",61            generics: [{62                name: "约束C",63                fullPath: ["约束c"],64                pathWithoutLast: [],65                pathLast: "约束c",66                generics: [],67            }],68        }],69        foundElems: 3,70        totalElems: 5,71        literalSearch: true,72        userQuery: "类型A,类型B<约束C>->返回类型<关联类型=路径::约束D>",73        returned: [{74            name: "返回类型",75            fullPath: ["返回类型"],76            pathWithoutLast: [],77            pathLast: "返回类型",78            generics: [],79            bindings: [["关联类型", [{80                name: "路径::约束D",81                fullPath: ["路径", "约束d"],82                pathWithoutLast: ["路径"],83                pathLast: "约束d",84                generics: [],85            }]]],86        }],87        error: null,88    },89    {90        query: 'my_crate 中文宏!',91        elems: [{92            name: "my_crate 中文宏",93            fullPath: ["my_crate", "中文宏"],94            pathWithoutLast: ["my_crate"],95            pathLast: "中文宏",96            generics: [],97            typeFilter: "macro",98        }],99        foundElems: 1,100        userQuery: "my_crate 中文宏!",101        returned: [],102        error: null,103    },104    {105        query: '非法符号——',106        elems: [],107        foundElems: 0,108        userQuery: "非法符号——",109        returned: [],110        error: "Unexpected `—` after `号` (not a valid identifier)",111    }112]113const EXPECTED = [114    {115        query: '加法',116        others: [117            {118                name: "加法",119                path: "non_english_identifier",120                href: "../non_english_identifier/trait.加法.html",121                desc: "Add"122            },123            {124                name: "add",125                path: "non_english_identifier",126                is_alias: true,127                alias: "加法",128                href: "../non_english_identifier/fn.add.html"129            },130            {131                name: "add",132                path: "non_english_identifier",133                is_alias: true,134                alias: "加法",135                href: "../non_english_identifier/macro.add.html"136            },137        ],138        in_args: [{139            name: "加上",140            path: "non_english_identifier::加法",141            href: "../non_english_identifier/trait.加法.html#tymethod.加上",142        }],143        returned: [],144    },145    { // levensthein and substring checking only kick in at three characters146        query: '加法宏',147        others: [148            {149                name: "中文名称的加法宏",150                path: "non_english_identifier",151                href: "../non_english_identifier/macro.中文名称的加法宏.html",152            }],153        in_args: [],154        returned: [],155    },156    { // levensthein and substring checking only kick in at three characters157        query: '加法A',158        others: [159            {160                name: "中文名称的加法API",161                path: "non_english_identifier",162                href: "../non_english_identifier/fn.中文名称的加法API.html",163            }],164        in_args: [],165        returned: [],166    },167    { // Extensive type-based search is still buggy, experimental & work-in-progress.168        query: '可迭代->可选',169        others: [{170            name: "总计",171            path: "non_english_identifier",172            href: "../non_english_identifier/fn.总计.html",173            desc: "“sum”"174        }],175        in_args: [],176        returned: [],177    },178];

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.