SASUnit Examples  Version 1.5.0
_scenario.sas
Go to the documentation of this file.
1 
22 %MACRO _scenario(io_target =
23  );
24 
25  %LOCAL l_macname;
26 
27  %LET l_macname=&sysmacroname;
28 
29  OPTIONS MAUTOSOURCE MPRINT LINESIZE=MAX;
30 
31  /* initialize error handling */
32  %_initErrorHandler;
33 
34  /* check for target directory*/
35  %IF %_handleError(&l_macname
36  ,InvalidTargetDir
37  ,"&io_target" EQ "" OR NOT %_existDir(&io_target)
38  ,target directory &io_target does not exist
39  )
40  %THEN %GOTO errexit;
41 
42  /* create libref for test database*/
43  LIBNAME target "&io_target";
44  %IF %_handleError(&l_macname
45  ,ErrorNoTargetDirLib
46  ,%quote(&syslibrc.) NE 0
47  ,test database cannot be opened
48  )
49  %THEN %GOTO errexit;
50 
51  /* set global macro symbols and librefs / filerefs */
52  /* includes creation of autocall paths */
53  %_loadEnvironment()
54 
55  %IF &g_error_code NE %THEN %GOTO errexit;
56 
57  /* flag for test cases */
58  %GLOBAL g_inTestcase;
59  %LET g_inTestcase=0;
60 
61  %GOTO exit;
62  %errexit:
63  %PUT ========================== Error! Test scenario will be aborted! ================================;
64  LIBNAME target;
65  %exit:
66 %MEND _scenario;