From 5cd748d33dfc9ce18f1aa1beca9ba7a10d698e3b Mon Sep 17 00:00:00 2001 From: Pete Freitag Date: Mon, 26 Feb 2018 13:41:01 -0500 Subject: [PATCH] Changed how examples are tested --- tests/Application.cfc | 5 ++--- tests/tests/TestExamples.cfc | 29 ++++++++++++++--------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/tests/Application.cfc b/tests/Application.cfc index cdeac6afc..7ef76592b 100644 --- a/tests/Application.cfc +++ b/tests/Application.cfc @@ -3,10 +3,9 @@ component { this.mappings[ "/testbox" ] = ExpandPath( "./testbox" ); this.mappings[ "/tests" ] = ExpandPath( "./tests" ); + this.mappings[ "/temp" ] = getTempDirectory(); this.timezone="UTC"; - public void function onRequest( required string requestedTemplate ) { - include arguments.requestedTemplate; - } + } \ No newline at end of file diff --git a/tests/tests/TestExamples.cfc b/tests/tests/TestExamples.cfc index 145eccce6..1774a1227 100644 --- a/tests/tests/TestExamples.cfc +++ b/tests/tests/TestExamples.cfc @@ -29,26 +29,25 @@ component extends="testbox.system.BaseSpec" { } if (!find("writeOutput( " & e.code & ");"); + + cfsavecontent( variable="actualResult" ) { + include template="#local.examplePath#"; + } + + actualResult = trim(actualResult); } catch(any ex) { - if (ex.message == "Syntax Error, invalid Expression [" & e.code & "]") { - if (reFindNoCase("[""'][a-z0-9 ]+[""']\.[a-z]+\(", e.code)) { - //Lucee does not like "String".memberFunction() - //in evaluate but it is valid otherwise - continue; - } + actualResult = "EXCEPTION in example #idx# in #fileName#: #ex.message#"; + } finally { + if (fileExists(local.examplePath)) { + fileDelete(local.examplePath); } - actualResult = "EXCEPTION in example #idx#: #ex.message#"; } - //workaround bug: listRemoveDuplicates adds trailing comma in lucee - //https://luceeserver.atlassian.net/browse/LDEV-387 - if (json.name == "listRemoveDuplicates" && server.keyExists("lucee")) { - if (right(actualResult, 1) == ",") { - e.result = e.result & ","; - } - } + if (isBoolean(e.result) && !isNumeric(e.result)) { expect(isBoolean(actualResult)).toBeTrue("#fileName# example result is:#e.result# but evaluated to:#actualResult#"); if (e.result == true) {