The script does not process business data. It defines local variables to store directory paths (existing and non-existing) and uses the 'WORK' system library for a path internal to the SAS session.
1 Code Block
SASUNIT Macro Calls
Explanation : Initializes the SASUnit test scenario and defines three macro variables: `existing` for an existing directory path (the SAS work directory), `existing2` for the same path with a trailing slash, and `not_existing` for a deliberately non-existent directory path.
Explanation : First test case: checks if the `_existdir` macro returns 1 (true) for an existing directory (`&existing`). It uses `%assertEquals` to confirm that the result is indeed 1.
Explanation : Second test case: checks if the `_existdir` macro returns 1 (true) for an existing directory with a trailing slash (`&existing2`). `%assertEquals` is used to validate that the result is 1.
Explanation : Third test case: checks if the `_existdir` macro returns 0 (false) for a non-existent directory (`¬_existing`). `%assertEquals` confirms that the result is 0.
Copied!
%initTestcase(i_object=_existDir.sas, i_desc=not existing folder)
%LET exists = %_existdir(¬_existing);
%endTestcall;
%assertEquals(i_expected=0, i_actual=&exists, i_desc=folder does not exists)
%endTestcase;
%assertEquals(i_expected=0, i_actual=&exists, i_desc=folder does not exists)
5
%endTestcase;
5 Code Block
SASUNIT Macro Calls
Explanation : Ends the SASUnit test scenario.
Copied!
%endScenario();
1
%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.