1
0
mirror of https://github.com/sasjs/lint.git synced 2026-01-14 15:50:05 +00:00

fix(hasMacroNameInMend): added support for comments having code in it

This commit is contained in:
Saad Jutt
2021-04-06 14:34:51 +05:00
parent 2f07bfa0a1
commit 443bdc0a50
2 changed files with 65 additions and 6 deletions

View File

@@ -164,6 +164,48 @@ describe('hasMacroNameInMend', () => {
expect(hasMacroNameInMend.test(content)).toEqual([])
})
it('should return an array with a single diagnostic when %mend has correct macro name having code in comments', () => {
const content = `/**
@file examplemacro.sas
@brief an example of a macro to be used in a service
@details This macro is great. Yadda yadda yadda. Usage:
* code formatting applies when indented by 4 spaces; code formatting applies when indented by 4 spaces; code formatting applies when indented by 4 spaces; code formatting applies when indented by 4 spaces; code formatting applies when indented by 4 spaces;
some code
%macro examplemacro123();
%examplemacro()
<h4> SAS Macros </h4>
@li doesnothing.sas
@author Allan Bowe
**/
%macro examplemacro();
proc sql;
create table areas
as select area
from sashelp.springs;
%doesnothing();
%mend;`
expect(hasMacroNameInMend.test(content)).toEqual([
{
message: '%mend missing macro name',
lineNumber: 29,
startColumnNumber: 5,
endColumnNumber: 11,
severity: Severity.Warning
}
])
})
it('should return an array with a single diagnostic when %mend has incorrect macro name', () => {
const content = `
%macro somemacro;