Skip to content

Commit

Permalink
Add test for parsing @param with type containing spaces in LiquidDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmengo committed Jan 14, 2025
1 parent eaf6224 commit 9edbe0a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/liquid-html-parser/src/stage-1-cst.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,23 @@ describe('Unit: Stage 1 (CST)', () => {
);
});

it('should parse @param with type with space inside', () => {
const testStr = `{% doc %} @param { String } paramWithType {% enddoc %}`;
cst = toCST(testStr);

expectPath(cst, '0.children.0.type').to.equal('LiquidDocParamNode');
expectPath(cst, '0.children.0.paramName.value').to.equal('paramWithType');

expectPath(cst, '0.children.0.paramType.type').to.equal('TextNode');
expectPath(cst, '0.children.0.paramType.value').to.equal('String');
expectPath(cst, '0.children.0.paramType.locStart').to.equal(
testStr.indexOf('{ String }'),
);
expectPath(cst, '0.children.0.paramType.locEnd').to.equal(
testStr.indexOf('{ String }') + '{ String }'.length,
);
});

it('should accept punctation inside the param description body', () => {
const testStr = `{% doc %} @param paramName paramDescription - asdf . \`should\` work {% enddoc %}`;
cst = toCST(testStr);
Expand Down

0 comments on commit 9edbe0a

Please sign in to comment.