Files
NapCatQQ/.pnpm-store/v3/files/90/421d1a3738ed8368277c45a5c4e48b6c100db225504b17c0f9c9047398d152a428392c205e5ed238747b960204b46640fbd9690435d6a6b5603c446d05829b
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

44 lines
2.1 KiB
Plaintext

import getParser from '../../src/parser/index.js';
import inspect from '../../src/stringifier/inspect.js';
import { seedBlock } from '../../src/util.js';
test('multiple lines', () => {
const source = `
/**
* Description may go\r\r
* over few lines followed by @tags\r
* @param {string} name name parameter
* @param {any} value value of any type
*/`.slice(1);
const parsed = getParser()(source);
const expected = `
|line|start|delimiter|postDelimiter|tag |postTag|name |postName|type |postType|description |end|CR |
|----|-----|---------|-------------|------|-------|-----|--------|--------|--------|--------------------------------|---|---|
| 0|{2} |/** | | | | | | | | | | |
| 1|{3} |* |{1} | | | | | | |Description may go | |{2}|
| 2|{3} |* |{1} | | | | | | |over few lines followed by @tags| |{1}|
| 3|{3} |* |{1} |@param|{1} |name |{1} |{string}|{1} |name parameter | | |
| 4|{3} |* |{1} |@param|{1} |value|{1} |{any} |{1} |value of any type | | |
| 5|{3} | | | | | | | | | |*/ | |`;
expect(inspect(parsed[0])).toEqual(expected.slice(1));
});
test('single line', () => {
const source = '/** @param {string} name name parameter */';
const parsed = getParser({ startLine: 12345 })(source);
const expected = `
|line |start|delimiter|postDelimiter|tag |postTag|name|postName|type |postType|description |end|CR|
|-----|-----|---------|-------------|------|-------|----|--------|--------|--------|---------------|---|--|
|12345| |/** |{1} |@param|{1} |name|{1} |{string}|{1} |name parameter |*/ | |`;
expect(inspect(parsed[0])).toEqual(expected.slice(1));
});
test('empty', () => {
const expected = '';
expect(inspect(seedBlock())).toEqual(expected.slice(1));
});