From 2fe7fba79b36f8a00cd42c3b00d9b18753e599d7 Mon Sep 17 00:00:00 2001 From: munja Date: Sat, 5 Feb 2022 21:19:26 +0100 Subject: [PATCH 1/3] fix: adding support for testsetup and testteardown in mf_getapploc.sas --- all.sas | 9 +++++++-- base/mf_getapploc.sas | 9 +++++++-- tests/crossplatform/mf_getapploc.test.sas | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/all.sas b/all.sas index f36957a..0f36f30 100644 --- a/all.sas +++ b/all.sas @@ -352,6 +352,7 @@ https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md#functionex @li /data @li /jobs @li /services + @li /tests @li /tests/jobs @li /tests/services @li /tests/macros @@ -383,9 +384,13 @@ https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md#functionex /** * First check we are not in the tests/macros folder (which has no subfolders) + * or specifically in the testsetup or testteardown services */ -%if %index(&pgm,/tests/macros/) %then %do; - %let root=%substr(&pgm,1,%index(&pgm,/tests/macros)-1); +%if %index(&pgm,/tests/macros/) +or %index(&pgm,/tests/testsetup) +or %index(&pgm,/tests/testteardown) +%then %do; + %let root=%substr(&pgm,1,%index(&pgm,/tests)-1); &root %return; %end; diff --git a/base/mf_getapploc.sas b/base/mf_getapploc.sas index 1f3cbcf..101b3a1 100644 --- a/base/mf_getapploc.sas +++ b/base/mf_getapploc.sas @@ -15,6 +15,7 @@ @li /data @li /jobs @li /services + @li /tests @li /tests/jobs @li /tests/services @li /tests/macros @@ -46,9 +47,13 @@ /** * First check we are not in the tests/macros folder (which has no subfolders) + * or specifically in the testsetup or testteardown services */ -%if %index(&pgm,/tests/macros/) %then %do; - %let root=%substr(&pgm,1,%index(&pgm,/tests/macros)-1); +%if %index(&pgm,/tests/macros/) +or %index(&pgm,/tests/testsetup) +or %index(&pgm,/tests/testteardown) +%then %do; + %let root=%substr(&pgm,1,%index(&pgm,/tests)-1); &root %return; %end; diff --git a/tests/crossplatform/mf_getapploc.test.sas b/tests/crossplatform/mf_getapploc.test.sas index 4dbd598..4bd479f 100644 --- a/tests/crossplatform/mf_getapploc.test.sas +++ b/tests/crossplatform/mf_getapploc.test.sas @@ -46,4 +46,20 @@ ), desc=Checking tests/macros appLoc matches (which has no subfolder), outds=work.test_results +) + +%mp_assert( + iftrue=( + "%mf_getapploc(/some/area/tests/testsetup)"="/some/area" + ), + desc=Checking tests/testsetup operation, + outds=work.test_results +) + +%mp_assert( + iftrue=( + "%mf_getapploc(/some/area/tests/testteardown)"="/some/area" + ), + desc=Checking tests/teardown operation, + outds=work.test_results ) \ No newline at end of file From df0fa955190bcf8ac0fafcd02946b6cfd1caf3f6 Mon Sep 17 00:00:00 2001 From: munja Date: Sat, 5 Feb 2022 21:29:03 +0100 Subject: [PATCH 2/3] fix: adding sasjs/core dependency - see: https://github.com/sasjs/cli/issues/1113 --- package-lock.json | 15 ++++++++++++++- package.json | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 684d93b..caa5b92 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,8 @@ "name": "@sasjs/core", "license": "MIT", "devDependencies": { - "@sasjs/cli": "3.6.0" + "@sasjs/cli": "3.6.0", + "@sasjs/core": "4.4.4" } }, "node_modules/@sasjs/adapter": { @@ -108,6 +109,12 @@ "valid-url": "^1.0.9" } }, + "node_modules/@sasjs/core": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/@sasjs/core/-/core-4.4.4.tgz", + "integrity": "sha512-gN6d0fvhaofp7buemS5KIOo5Bz8lbqhsEQD7SuH5FZ02MQurmfu7A0Zg0lIEi0w2/ptI4M/sZdF4D2DRh1D5xA==", + "dev": true + }, "node_modules/@sasjs/lint": { "version": "1.11.2", "resolved": "https://registry.npmjs.org/@sasjs/lint/-/lint-1.11.2.tgz", @@ -2822,6 +2829,12 @@ } } }, + "@sasjs/core": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/@sasjs/core/-/core-4.4.4.tgz", + "integrity": "sha512-gN6d0fvhaofp7buemS5KIOo5Bz8lbqhsEQD7SuH5FZ02MQurmfu7A0Zg0lIEi0w2/ptI4M/sZdF4D2DRh1D5xA==", + "dev": true + }, "@sasjs/lint": { "version": "1.11.2", "resolved": "https://registry.npmjs.org/@sasjs/lint/-/lint-1.11.2.tgz", diff --git a/package.json b/package.json index 9817713..56b831a 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks || true" }, "devDependencies": { - "@sasjs/cli": "3.6.0" + "@sasjs/cli": "3.6.0", + "@sasjs/core": "4.4.4" } } From ec4de95fcf9b1536679cde6d653a2fdab0551162 Mon Sep 17 00:00:00 2001 From: munja Date: Sat, 5 Feb 2022 21:55:50 +0100 Subject: [PATCH 3/3] fix: reset syscc for testterm syscc check --- tests/viyaonly/mv_jobflow.test.1.sas | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/viyaonly/mv_jobflow.test.1.sas b/tests/viyaonly/mv_jobflow.test.1.sas index 56df6a3..c608b4a 100644 --- a/tests/viyaonly/mv_jobflow.test.1.sas +++ b/tests/viyaonly/mv_jobflow.test.1.sas @@ -76,3 +76,6 @@ run; iftrue=(&syscc ne 0), desc=Check that non zero return code is returned if called job fails ) + +/* set syscc to zero for final check in testterm */ +%let syscc=0; \ No newline at end of file