The script does not directly manipulate external data or data from `SASHELP`. It uses internal data (a literal warning message) to test the behavior of a SASUnit macro. The SASUnit framework itself manages the configuration of logs and assertions necessary for test execution.
1 Code Block
SASUnit Initialization / Macro Definition
Explanation : This block initializes a SASUnit test scenario with a clear description. It then defines a macro named `testcase` which will serve as a wrapper for the test logic. The `i_object` and `i_desc` parameters of this macro are used to specify the tested object and a contextual description of the test case.
Copied!
%initScenario (i_desc=Test of _issueassertwarningmessage.sas);
%macro testcase(i_object=_issueassertwarningmessage.sas, i_desc=%str(Correct call of examinee));
1
%initScenario (i_desc=Test of _issueassertwarningmessage.sas);
2
%macro testcase(i_object=_issueassertwarningmessage.sas, i_desc=%str(Correct call of examinee));
3
2 Code Block
Macro Call / SASUnit Assertions
Explanation : This block, contained within the `testcase` macro, initializes the specific test case. It calls the `_issueassertwarningmessage` macro with a literal warning message in German. After the execution of this macro, the test proceeds with assertions: `%assertLog` verifies that no error messages are present in the log and that exactly one warning has been issued. `%assertLogMsg` then confirms that the specific text of the expected warning is present in the log.
%_issueassertwarningmessage(Dies ist meine Warnmeldung!);
14
15
%endTestcall()
16
17
/* assert */
18
%assertLog (i_errors=0, i_warnings=1);
19
%assertLogMsg (i_logMsg=^WARNING: Dies ist meine Warnmeldung!);
3 Code Block
Macro End / Test Execution / Scenario End
Explanation : This block marks the end of the `testcase` macro definition and its test case (`%endTestcase`, `%mend testcase`). Immediately after, the `testcase` macro is invoked (`%testcase;`) to execute the test. Finally, `%endScenario()` closes the entire SASUnit test scenario.
Copied!
/* end testcase */
%endTestcase()
%mend testcase; %testcase;
%endScenario();
1
/* end testcase */
2
%endTestcase()
3
%mend testcase; %testcase;
4
5
%endScenario();
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright 2010-2023 HMS Analytical Software GmbH, http://www.analytical-software.de. This file is part of SASUnit, the Unit testing framework for SAS(R) programs. For copyright information and terms of usage under the GNU Lesser General Public License see included file README.md or https://github.com/HMS-Analytical-Software/SASUnit/wiki/readme/.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.