From ac6795183f5ed9a6804d3ea785a2ae813eee9c24 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Fri, 27 Sep 2019 15:33:37 -0500 Subject: [PATCH 01/11] version bump --- box.json | 2 +- system/TestResult.cfc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/box.json b/box.json index e41bf666..494cb68d 100644 --- a/box.json +++ b/box.json @@ -1,6 +1,6 @@ { "name":"TestBox", - "version":"3.1.0", + "version":"3.2.0", "location":"https://downloads.ortussolutions.com/ortussolutions/testbox/@build.version@/testbox-@build.version@.zip", "author":"Ortus Solutions ", "slug":"testbox", diff --git a/system/TestResult.cfc b/system/TestResult.cfc index 764c0c57..2bd011e2 100644 --- a/system/TestResult.cfc +++ b/system/TestResult.cfc @@ -54,7 +54,7 @@ component accessors="true" { // internal id variables.resultsID = createUUID(); // TestBox version - variables.version = "3.1.0-snapshot"; + variables.version = "@build.version@"; // Global test durations variables.startTime = getTickCount(); variables.endTime = 0; From 7f27683bb96e664504b848c55794ca369a36a0ed Mon Sep 17 00:00:00 2001 From: Brad Wood Date: Wed, 16 Oct 2019 16:39:52 +0200 Subject: [PATCH 02/11] TESTBOX-265 --- system/coverage/data/CoverageGenerator.cfc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/system/coverage/data/CoverageGenerator.cfc b/system/coverage/data/CoverageGenerator.cfc index a989ce88..6daff053 100644 --- a/system/coverage/data/CoverageGenerator.cfc +++ b/system/coverage/data/CoverageGenerator.cfc @@ -193,6 +193,11 @@ component accessors=true { covered = previousLineRan; } + // Count as covered any closing parenthesis where the previous line ran. + if( !covered && previousLineRan && ( trim( line ) == ');' || trim( line ) == ')' ) ) { + covered = previousLineRan; + } + // Count as covered any cffunction or cfargument tag where the previous line ran. if( !covered && reFindNoCase( '^ Date: Thu, 21 Nov 2019 10:34:15 -0600 Subject: [PATCH 03/11] Preserve line breaks for stack trace --- system/reports/assets/simple.cfm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/system/reports/assets/simple.cfm b/system/reports/assets/simple.cfm index 66fd7336..30a715f4 100644 --- a/system/reports/assets/simple.cfm +++ b/system/reports/assets/simple.cfm @@ -551,10 +551,14 @@ code {
- - - - +

Failure Origin

+ +

Failure Details

+ +

Failure StackTrace

+
#local.thisSpec.failStackTrace#
+

Failure Extended Info

+
From 2013b53eb65e873c4300ac02b2fbe7818f364eb3 Mon Sep 17 00:00:00 2001 From: Stewart McGuire Date: Mon, 9 Dec 2019 09:11:03 -0500 Subject: [PATCH 04/11] Moved invoke block from bottom of method into if block for "detech negation" as that is the only way that it should be called. Restored original exception throw at the bottom of the method to throw an exception for invalid/missing methods. --- system/Expectation.cfc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/system/Expectation.cfc b/system/Expectation.cfc index 007b5d56..f1c60715 100644 --- a/system/Expectation.cfc +++ b/system/Expectation.cfc @@ -71,6 +71,15 @@ component accessors="true" { arguments.missingMethodName = right( arguments.missingMethodName, len( arguments.missingMethodName ) - 3 ); // set isNot pivot on this matcher this.isNot = true; + + // execute the dynamic method + var results = invoke( this, arguments.missingMethodName, arguments.missingMethodArguments ); + if ( !isNull( results ) ) { + return results; + } + else { + return; + } } // detect toBeTypeOf dynamic shortcuts @@ -93,14 +102,8 @@ component accessors="true" { return toBeTypeOf( type = type, message = message ); } - // execute the dynamic method - var results = invoke( this, arguments.missingMethodName, arguments.missingMethodArguments ); - if ( !isNull( results ) ) { - return results; - } - // throw exception - // throw(type="InvalidMethod", message="The dynamic/static method: #arguments.missingMethodName# does not exist in this CFC", detail="Available methods are #structKeyArray( this ).toString()#"); + throw(type="InvalidMethod", message="The dynamic/static method: #arguments.missingMethodName# does not exist in this CFC", detail="Available methods are #structKeyArray( this ).toString()#"); } /** From 5baa3c1751d368dafb175957b06bc54a0f4f3469 Mon Sep 17 00:00:00 2001 From: John Whish Date: Thu, 9 Jan 2020 09:42:00 +0000 Subject: [PATCH 05/11] When the key existed notToHaveKey wasn't failing Added test to prove it and flipped the logic --- system/Assertion.cfc | 2 +- tests/specs/EdgeCases.cfc | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/system/Assertion.cfc b/system/Assertion.cfc index b4b72171..4b207810 100644 --- a/system/Assertion.cfc +++ b/system/Assertion.cfc @@ -363,7 +363,7 @@ component { arguments.key .listToArray() .filter( function( thisKey ){ - return !structKeyExists( target, arguments.thisKey ); + return structKeyExists( target, arguments.thisKey ); } ) .len() > 0 ){ diff --git a/tests/specs/EdgeCases.cfc b/tests/specs/EdgeCases.cfc index f7c2b382..b87406ac 100644 --- a/tests/specs/EdgeCases.cfc +++ b/tests/specs/EdgeCases.cfc @@ -64,6 +64,18 @@ component extends="testbox.system.BaseSpec" { } }); + describe( "When testing a key does not exists", function(){ + var data = {name="luis", awesome=true}; + it( "should pass when the key does not exist", function(){ + expect( data ).notToHaveKey( "age" ); + }); + it( "should fail when the key does exist", function(){ + expect( function(){ + expect( data ).notToHaveKey( "name" ); + } ).toThrow( type = "TestBox.AssertionFailed" ); + }); + }); + } private function myFakeClosure(){ From 6e4bbfab9909452a7973e7c461fd0c9f24f30b17 Mon Sep 17 00:00:00 2001 From: Stephen Condon Date: Thu, 23 Jan 2020 08:07:07 -0600 Subject: [PATCH 06/11] Add return this to key() When chaining assertions in an xUnit spec, we get a value must be initialized error if we chain anything off of key(). By adding this line, method chaining will work as expected. Let me know if that doesn't make sense, or if you see any issues with it. Example: $assert.lengthOf( results, 3 ) .key( results, "foo" ) .key( results, "bar" ); --- system/Assertion.cfc | 1 + 1 file changed, 1 insertion(+) diff --git a/system/Assertion.cfc b/system/Assertion.cfc index 4b207810..2ce44da3 100644 --- a/system/Assertion.cfc +++ b/system/Assertion.cfc @@ -341,6 +341,7 @@ component { ){ fail( arguments.message ); } + return this; } /** From b262884035b8172ec3e7c36ee86c56f16d4ccdf9 Mon Sep 17 00:00:00 2001 From: Stephen Condon Date: Tue, 28 Jan 2020 10:49:04 -0600 Subject: [PATCH 07/11] Fix missing raw_trace in simple.cfm If there's a syntax error in a dependent file called from a spec, this can cause the local.thisSpec.failOrigin[ 1 ] to not have a raw_trace key, which results in a generic CF 500 error in ACF (11 & 2018 were tested). By adding a key exists check, this allows the report to render and display the exception structure allowing much easier debugging of the syntax error. --- system/reports/assets/simple.cfm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/reports/assets/simple.cfm b/system/reports/assets/simple.cfm index 30a715f4..694d8c95 100644 --- a/system/reports/assets/simple.cfm +++ b/system/reports/assets/simple.cfm @@ -534,7 +534,7 @@ code {
#left( local.thisSpec.failDetail, 2500 )#
- +
#local.thisSpec.failOrigin[ 1 ].raw_trace#
@@ -575,4 +575,4 @@ code { - \ No newline at end of file + From 451d47b84c2d99d160cbbf35ee6103c2c1fdc2fe Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Mon, 24 Feb 2020 13:05:11 -0700 Subject: [PATCH 08/11] Lowercase cbstreams for case-sensitive file systems --- system/coverage/browser/CodeBrowser.cfc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/coverage/browser/CodeBrowser.cfc b/system/coverage/browser/CodeBrowser.cfc index 9a9db0d0..2742e418 100644 --- a/system/coverage/browser/CodeBrowser.cfc +++ b/system/coverage/browser/CodeBrowser.cfc @@ -16,7 +16,7 @@ component accessors = true { * @coverageTresholds Options for threshold */ function init( required struct coverageTresholds ) { - variables.streamBuilder = new testbox.system.modules.cbStreams.models.StreamBuilder(); + variables.streamBuilder = new testbox.system.modules.cbstreams.models.StreamBuilder(); variables.coverageTresholds = arguments.coverageTresholds; return this; @@ -119,4 +119,4 @@ component accessors = true { } } -} \ No newline at end of file +} From 922b667c13557c9a9ea9296095076504779be941 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 27 Feb 2020 15:17:05 -0600 Subject: [PATCH 09/11] TESTBOX-272 #resolve Add formatting config and scripts --- .cfformat.json | 110 ++++++++++++++++++++++++++----------------------- box.json | 4 ++ 2 files changed, 62 insertions(+), 52 deletions(-) diff --git a/.cfformat.json b/.cfformat.json index b2124e32..1831cd3d 100644 --- a/.cfformat.json +++ b/.cfformat.json @@ -1,54 +1,60 @@ { - "array.empty_padding" : false, - "array.padding" : true, - "array.multiline.min_length" : 40, - "array.multiline.element_count" : 4, - "array.multiline.leading_comma.padding" : true, - "array.multiline.leading_comma" : false, - "assignments.consecutive.alignment" : true, - "brackets.padding" : true, - "comment.asterisks" : "align", - "binary_operators.padding" : true, - "for_loop_semicolons.padding" : true, - "function_call.empty_padding" : false, - "function_call.padding" : true, - "function_call.multiline.leading_comma.padding" : true, - "function_call.casing.builtin" : "cfdocs", - "function_call.casing.userdefined" : "", - "function_call.multiline.element_count" : 4, - "function_call.multiline.leading_comma" : false, - "function_call.multiline.min_length" : 40, - "function_declaration.padding" : true, - "function_declaration.empty_padding" : false, - "function_declaration.multiline.leading_comma" : false, - "function_declaration.multiline.leading_comma.padding" : true, - "function_declaration.multiline.element_count" : 4, - "function_declaration.multiline.min_length" : 40, - "function_declaration.group_to_block_spacing" : "compact", - "function_anonymous.empty_padding" : false, - "function_anonymous.group_to_block_spacing" : "compact", - "function_anonymous.multiline.element_count" : 4, - "function_anonymous.multiline.leading_comma" : false, - "function_anonymous.multiline.leading_comma.padding" : true, - "function_anonymous.multiline.min_length" : 40, - "function_anonymous.padding" : true, - "indent_size" : 4, - "keywords.block_to_keyword_spacing" : "spaced", - "keywords.group_to_block_spacing" : "spaced", - "keywords.padding_inside_group" : true, - "keywords.spacing_to_block" : "spaced", - "keywords.spacing_to_group" : true, - "keywords.empty_group_spacing" : false, - "max_columns" : 120, - "parentheses.padding" : true, - "strings.quote" : "double", - "strings.attributes.quote" : "double", - "struct.separator" : " : ", - "struct.padding" : true, - "struct.empty_padding" : false, - "struct.multiline.leading_comma" : false, - "struct.multiline.leading_comma.padding" : true, - "struct.multiline.element_count" : 4, - "struct.multiline.min_length" : 40, - "tab_indent" : true + "array.empty_padding": false, + "array.padding": true, + "array.multiline.min_length": 40, + "array.multiline.element_count": 2, + "array.multiline.leading_comma.padding": true, + "array.multiline.leading_comma": false, + "alignment.consecutive.assignments": true, + "alignment.consecutive.properties": true, + "alignment.consecutive.params": true, + "brackets.padding": true, + "comment.asterisks": "align", + "binary_operators.padding": true, + "for_loop_semicolons.padding": true, + "function_call.empty_padding": false, + "function_call.padding": true, + "function_call.multiline.leading_comma.padding": true, + "function_call.casing.builtin": "cfdocs", + "function_call.casing.userdefined": "camel", + "function_call.multiline.element_count": 3, + "function_call.multiline.leading_comma": false, + "function_call.multiline.min_length": 40, + "function_declaration.padding": true, + "function_declaration.empty_padding": false, + "function_declaration.multiline.leading_comma": false, + "function_declaration.multiline.leading_comma.padding": true, + "function_declaration.multiline.element_count": 3, + "function_declaration.multiline.min_length": 40, + "function_declaration.group_to_block_spacing": "compact", + "function_anonymous.empty_padding": false, + "function_anonymous.group_to_block_spacing": "compact", + "function_anonymous.multiline.element_count": 3, + "function_anonymous.multiline.leading_comma": false, + "function_anonymous.multiline.leading_comma.padding": true, + "function_anonymous.multiline.min_length": 40, + "function_anonymous.padding": true, + "indent_size": 4, + "keywords.block_to_keyword_spacing": "spaced", + "keywords.group_to_block_spacing": "spaced", + "keywords.padding_inside_group": true, + "keywords.spacing_to_block": "spaced", + "keywords.spacing_to_group": true, + "keywords.empty_group_spacing": false, + "max_columns": 120, + "metadata.multiline.element_count": 3, + "metadata.multiline.min_length": 40, + "property.multiline.element_count": 3, + "property.multiline.min_length": 40, + "parentheses.padding": true, + "strings.quote": "double", + "strings.attributes.quote": "double", + "struct.separator": " : ", + "struct.padding": true, + "struct.empty_padding": false, + "struct.multiline.leading_comma": false, + "struct.multiline.leading_comma.padding": true, + "struct.multiline.element_count": 2, + "struct.multiline.min_length": 40, + "tab_indent": true } \ No newline at end of file diff --git a/box.json b/box.json index 494cb68d..23199ab4 100644 --- a/box.json +++ b/box.json @@ -40,5 +40,9 @@ }, "installPaths":{ "cbstreams":"system/modules/cbstreams/" + }, + "scripts":{ + "format":"cfformat run system/**/*.cfc,test-harness/**/*.cfc,tests/specs/**/*.cfc,*.cfc --overwrite", + "format:check":"cfformat run system/**/*.cfc,test-harness/**/*.cfc,tests/specs/**/*.cfc,*.cfc --check" } } From 9bb91c348f670641a4d9780626be339441c33130 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 27 Feb 2020 15:19:10 -0600 Subject: [PATCH 10/11] updated streams --- box.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box.json b/box.json index 23199ab4..3890a40e 100644 --- a/box.json +++ b/box.json @@ -36,7 +36,7 @@ "watchDelay":"250" }, "dependencies":{ - "cbstreams":"^1.3.0" + "cbstreams":"^1.5.0" }, "installPaths":{ "cbstreams":"system/modules/cbstreams/" From cf0a9ebd5199a704819b3bd3044b005544ca16c5 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 27 Feb 2020 15:22:34 -0600 Subject: [PATCH 11/11] small readme updates --- readme.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 5bf59074..5f35f802 100755 --- a/readme.md +++ b/readme.md @@ -45,6 +45,7 @@ Official Site - ColdFusion 11+ (xUnit + BDD) ## TESTBOX INSTALLATION + You can visit the TestBox documentation page to view all of its features and capabilities. To install TestBox just drop it in your web root as `/testbox` or create a mapping in your CFML administrator or `Application.cfc` that points to the @@ -64,10 +65,11 @@ Bleeding edge builds are updated automatically as code is committed. ******************************************************************************** Copyright Since 2005 by Luis Majano and Ortus Solutions, Corp - www.ortussolutions.com ******************************************************************************** -#### HONOR GOES TO GOD ABOVE ALL + +### HONOR GOES TO GOD ABOVE ALL + Because of His grace, this project exists. If you don't like this, then don't read it, its not for you. >"Therefore being justified by faith, we have peace with God through our Lord Jesus Christ: @@ -78,4 +80,5 @@ And hope maketh not ashamed; because the love of God is shed abroad in our heart Holy Ghost which is given unto us. ." Romans 5:5 ### THE DAILY BREAD + > "I am the way, and the truth, and the life; no one comes to the Father, but by me (JESUS)" Jn 14:1-12