Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mfv_getcaslib.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mfv_getcaslib macro function
4
5 <h4> SAS Macros </h4>
6 @li mfv_getcaslib.sas
7 @li mp_assert.sas
8 @li mp_assertscope.sas
9
10**/
11
12options mprint;
13
14/* ------------------------------------------------------------------------ */
15/* Setup: start a CAS session and assign caslibs */
16/* ------------------------------------------------------------------------ */
17cas mysess;
18caslib _all_ assign;
19
20%let testcaslib=Public;
21
22libname castest cas caslib=&testcaslib;
23
24/* ------------------------------------------------------------------------ */
25%put TEST 1 - returns the caslib name for a valid CAS libref;
26/* ------------------------------------------------------------------------ */
27%mp_assert(
28 iftrue=(%mfv_getcaslib(castest)=%upcase(&testcaslib)),
29 desc=Check correct caslib name returned for a valid CAS libref
30)
31
32
33/* ------------------------------------------------------------------------ */
34%put TEST 2 - returns empty for a non-CAS libref (WORK);
35/* ------------------------------------------------------------------------ */
36%mp_assert(
37 iftrue=(%mfv_getcaslib(WORK)=),
38 desc=Check empty string returned for a non-CAS libref
39)
40
41
42/* ------------------------------------------------------------------------ */
43%put TEST 3 - returns empty for a libref that does not exist;
44/* ------------------------------------------------------------------------ */
45%mp_assert(
46 iftrue=(%mfv_getcaslib(DOESNOTEXIST)=),
47 desc=Check empty string returned for a non-existent libref
48)
49
50
51/* ------------------------------------------------------------------------ */
52%put TEST 5 - no scope leakage into global macro variables;
53/* ------------------------------------------------------------------------ */
54%mp_assertscope(SNAPSHOT)
55
56%let _rc=%mfv_getcaslib(castest);
57
58%mp_assertscope(COMPARE,
59 desc=Check mfv_getcaslib does not leak macro variables into GLOBAL scope,
60 ignorelist=_RC
61)
62
63
64/* ------------------------------------------------------------------------ */
65/* Teardown */
66/* ------------------------------------------------------------------------ */
67cas mysess terminate;
68
69