Macros for SAS Application Developers
https://github.com/sasjs/core
mf_readfile.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing mf_readfile.sas macro
4 
5  <h4> SAS Macros </h4>
6  @li mf_readfile.sas
7  @li mf_writefile.sas
8  @li mp_assert.sas
9  @li mp_assertscope.sas
10 
11 **/
12 
13 %let f=&sasjswork/myfile.txt;
14 
15 %mf_writefile(&f,l1=some content,l2=more content)
16 data _null_;
17  infile "&f";
18  input;
19  putlog _infile_;
20 run;
21 
22 %mp_assert(
23  iftrue=(&syscc=0),
24  desc=Check code ran without errors,
25  outds=work.test_results
26 )
27 
28 /* test for scope leakage */
29 %global result;
30 %mp_assertscope(SNAPSHOT)
31 %put %mf_readfile(&f);
32 %mp_assertscope(COMPARE)
33 
34 /* test result */
35 %mp_assert(
36  iftrue=(%mf_readfile(&f)=some content),
37  desc=Checking first line was ingested successfully,
38  outds=work.test_results
39 )
40