Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mf_getuser.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mf_getuser macro
4
5 <h4> SAS Macros </h4>
6 @li mf_getuser.sas
7 @li mp_assert.sas
8 @li mp_assertscope.sas
9
10**/
11
12%mp_assertscope(SNAPSHOT)
13%put scope check:%mf_getuser();
14%mp_assertscope(COMPARE,
15 desc=Checking that mf_getuser does not leak scope,
16 outds=work.test_results
17)
18
19%mp_assert(
20 iftrue=(%length(%mf_getuser())>0),
21 desc=Checking that a user is always returned,
22 outds=work.test_results
23)
24
25%if %symexist(_sasjs_username) %then %do;
26 %mp_assert(
27 iftrue=(%mf_getuser()=&_sasjs_username),
28 desc=Checking that the SASjs end user is preferred over the session account,
29 outds=work.test_results
30 )
31 %mp_assert(
32 iftrue=(%mf_getuser() ne &sysuserid),
33 desc=Checking that the session account is not reported as the user,
34 outds=work.test_results
35 )
36%end;
37%else %do;
38 %mp_assert(
39 iftrue=(%mf_getuser()=&sysuserid),
40 desc=Checking that the session account is reported with no end user present,
41 outds=work.test_results
42 )
43%end;