27%let item=test_%mf_uid();
33 put
'%put ORIGINAL LINE;';
37 %let platform=%mf_getplatform();
38 %
if &platform=SASJS %then %
do;
39 %ms_createfile(&mcTestAppLoc/temp/&item..sas, inref=initpgm)
41 %
else %
if &platform=SASVIYA %then %
do;
42 %mv_createfile(path=&mcTestAppLoc/temp, name=&item..sas, inref=initpgm)
45 %let work=%sysfunc(pathname(work));
47 file
"&work/&item..sas";
52 %mm_createstp(stpname=&item
55 ,tree=&mcTestAppLoc/temp
67 put '%put APPENDED LINE;';
71%mp_assertscope(SNAPSHOT)
72%mx_append2pgm(&mcTestAppLoc/temp/&item, inref=toappnd)
73%mp_assertscope(COMPARE,
74 desc=Test 1: mx_append2pgm does not leak scope,
75 outds=work.test_results,
76 ignorelist=MC2_JADP1LEN MC2_JADP2LEN MC2_JADPNUM MC2_JADVLEN MC2_JADP3LEN
81 desc=Test 1: No errors after appending content to program,
82 outds=work.test_results
94 %let platform=%mf_getplatform();
95 %if &platform=SASVIYA %then %do;
96 filename verifrf filesrvc folderpath="&mcTestAppLoc/temp";
98 infile verifrf("&item..sas") lrecl=32000;
100 if index(_infile_,'ORIGINAL LINE') then call symputx('test2_orig','1');
101 if index(_infile_,'APPENDED LINE') then call symputx('test2_appd','1');
103 filename verifrf clear;
106 %mx_getcode(&mcTestAppLoc/temp/&item, outref=verifrf)
108 infile verifrf lrecl=32000;
110 if index(_infile_,'ORIGINAL LINE') then call symputx('test2_orig','1');
111 if index(_infile_,'APPENDED LINE') then call symputx('test2_appd','1');
118 iftrue=(&test2_orig=1),
119 desc=Test 2a: Original content is preserved after append,
120 outds=work.test_results
124 iftrue=(&test2_appd=1),
125 desc=Test 2b: Appended content is present in modified program,
126 outds=work.test_results
132filename toappd2 temp;
135 put '%put SECOND APPEND;';
138%mp_assertscope(SNAPSHOT)
139%mx_append2pgm(&mcTestAppLoc/temp/&item, inref=toappd2)
140%mp_assertscope(COMPARE,
141 desc=Test 3: mx_append2pgm does not leak scope on second call,
142 outds=work.test_results
150%macro verify_test3();
151 %let platform=%mf_getplatform();
152 %if &platform=SASVIYA %then %do;
153 filename verifr2 filesrvc folderpath="&mcTestAppLoc/temp";
155 infile verifr2("&item..sas") lrecl=32000;
157 if index(_infile_,'ORIGINAL LINE') then call symputx('test3_orig','1');
158 if index(_infile_,'APPENDED LINE') then call symputx('test3_appd','1');
159 if index(_infile_,'SECOND APPEND') then call symputx('test3_app2','1');
161 filename verifr2 clear;
164 %mx_getcode(&mcTestAppLoc/temp/&item, outref=verifr2)
166 infile verifr2 lrecl=32000;
168 if index(_infile_,'ORIGINAL LINE') then call symputx('test3_orig','1');
169 if index(_infile_,'APPENDED LINE') then call symputx('test3_appd','1');
170 if index(_infile_,'SECOND APPEND') then call symputx('test3_app2','1');
177 iftrue=(&test3_orig=1),
178 desc=Test 3a: Original content still present after second append,
179 outds=work.test_results
183 iftrue=(&test3_appd=1),
184 desc=Test 3b: First appended content still present after second append,
185 outds=work.test_results
189 iftrue=(&test3_app2=1),
190 desc=Test 3c: Second appended content is present,
191 outds=work.test_results