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