From 12deff9e5b8ffda5cd06f74dd21a4fea92741ff8 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 5 Sep 2024 16:00:43 +0200 Subject: [PATCH] TESTBOX-393 #resolve New environment helpers to do skip detections or anything you see fit: isAdobe, isLucee, isBoxLang, isWindows, isMac, isLinux --- system/Assertion.cfc | 4 ++-- system/BaseSpec.cfc | 33 +++++++++++++++++++++++++++++- tests/specs/BaseAssertionsTest.cfc | 5 ++++- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/system/Assertion.cfc b/system/Assertion.cfc index fcc646a..d8b82c2 100644 --- a/system/Assertion.cfc +++ b/system/Assertion.cfc @@ -22,9 +22,9 @@ component { } /** - * Skip Test + * Skip a Test * - * @message The message to send in the skip + * @message The message to send in the skip information dialog * @detail The detail to add in the exception */ function skip( message = "", detail = "" ){ diff --git a/system/BaseSpec.cfc b/system/BaseSpec.cfc index ddfc538..36f9a56 100644 --- a/system/BaseSpec.cfc +++ b/system/BaseSpec.cfc @@ -80,7 +80,8 @@ component { /** * Skip a test * - * @facade + * @message The message to send in the skip information dialog + * @detail The detail to add in the exception */ function skip( message = "", detail = "" ){ this.$assert.skip( argumentCollection = arguments ); @@ -1707,4 +1708,34 @@ component { return results; } + /** + * ------------------------------------------------------------------ + * Environment Skipping Helpers + * ------------------------------------------------------------------ + */ + + function isAdobe(){ + return server.keyExists( "coldfusion" ) && server.coldfusion.productName.findNoCase( "ColdFusion Server" ); + } + + function isLucee(){ + return server.keyExists( "lucee" ); + } + + function isBoxLang(){ + return server.keyExists( "boxlang" ); + } + + function isWindows(){ + return server.keyExists( "os" ) && server.os.name.findNoCase( "windows" ); + } + + function isLinux(){ + return server.keyExists( "os" ) && server.os.name.findNoCase( "unix" ); + } + + function isMac(){ + return server.keyExists( "os" ) && server.os.name.findNoCase( "mac" ); + } + } diff --git a/tests/specs/BaseAssertionsTest.cfc b/tests/specs/BaseAssertionsTest.cfc index 9d2b300..eaca68e 100644 --- a/tests/specs/BaseAssertionsTest.cfc +++ b/tests/specs/BaseAssertionsTest.cfc @@ -144,7 +144,10 @@ component labels="lucee,cf" extends="testbox.system.BaseSpec" { ); } - function testIsEqualQuery(){ + /** + * Skipped until BoxLang supports query of queries + */ + function testIsEqualQuery() skip="isBoxLang"{ var a = ""; var b = ""; var testQuery = queryNew( "column_a,column_b" );