mirror of
https://github.com/sasjs/lint.git
synced 2026-01-07 12:40:05 +00:00
fix(hasMacroParentheses): added additional test also
This commit is contained in:
@@ -44,6 +44,21 @@ describe('hasMacroParentheses', () => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should return an array with a single diagnostic when macro defined without name ( single line code )', () => {
|
||||||
|
const content = `
|
||||||
|
%macro (); %put &sysmacroname; %mend;`
|
||||||
|
|
||||||
|
expect(hasMacroParentheses.test(content)).toEqual([
|
||||||
|
{
|
||||||
|
message: 'Macro definition missing name',
|
||||||
|
lineNumber: 2,
|
||||||
|
startColumnNumber: 3,
|
||||||
|
endColumnNumber: 12,
|
||||||
|
severity: Severity.Warning
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
it('should return an array with a single diagnostic when macro defined without name and parentheses', () => {
|
it('should return an array with a single diagnostic when macro defined without name and parentheses', () => {
|
||||||
const content = `
|
const content = `
|
||||||
%macro ;
|
%macro ;
|
||||||
@@ -55,7 +70,7 @@ describe('hasMacroParentheses', () => {
|
|||||||
message: 'Macro definition missing name',
|
message: 'Macro definition missing name',
|
||||||
lineNumber: 2,
|
lineNumber: 2,
|
||||||
startColumnNumber: 3,
|
startColumnNumber: 3,
|
||||||
endColumnNumber: 10,
|
endColumnNumber: 9,
|
||||||
severity: Severity.Warning
|
severity: Severity.Warning
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ const test = (value: string, config?: LintConfig) => {
|
|||||||
message: 'Macro definition missing name',
|
message: 'Macro definition missing name',
|
||||||
lineNumber: macro.startLineNumber!,
|
lineNumber: macro.startLineNumber!,
|
||||||
startColumnNumber: getColumnNumber(macro.declaration, '%macro'),
|
startColumnNumber: getColumnNumber(macro.declaration, '%macro'),
|
||||||
endColumnNumber: macro.declaration.length,
|
endColumnNumber:
|
||||||
|
getColumnNumber(macro.declaration, '%macro') +
|
||||||
|
macro.declarationTrimmedStatement.length,
|
||||||
severity: Severity.Warning
|
severity: Severity.Warning
|
||||||
})
|
})
|
||||||
} else if (!macro.declaration.includes('(')) {
|
} else if (!macro.declaration.includes('(')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user