mirror of
https://github.com/sasjs/lint.git
synced 2025-12-11 01:44:36 +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', () => {
|
||||
const content = `
|
||||
%macro ;
|
||||
@@ -55,7 +70,7 @@ describe('hasMacroParentheses', () => {
|
||||
message: 'Macro definition missing name',
|
||||
lineNumber: 2,
|
||||
startColumnNumber: 3,
|
||||
endColumnNumber: 10,
|
||||
endColumnNumber: 9,
|
||||
severity: Severity.Warning
|
||||
}
|
||||
])
|
||||
|
||||
@@ -18,7 +18,9 @@ const test = (value: string, config?: LintConfig) => {
|
||||
message: 'Macro definition missing name',
|
||||
lineNumber: macro.startLineNumber!,
|
||||
startColumnNumber: getColumnNumber(macro.declaration, '%macro'),
|
||||
endColumnNumber: macro.declaration.length,
|
||||
endColumnNumber:
|
||||
getColumnNumber(macro.declaration, '%macro') +
|
||||
macro.declarationTrimmedStatement.length,
|
||||
severity: Severity.Warning
|
||||
})
|
||||
} else if (!macro.declaration.includes('(')) {
|
||||
|
||||
Reference in New Issue
Block a user