From bfc71b0e366c0505a0edcfb70ce8a9b97325d1b8 Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Fri, 7 Jun 2024 02:36:43 +0200 Subject: [PATCH] LDEV-4866 improve tests --- test/tickets/LDEV4866.cfc | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/test/tickets/LDEV4866.cfc b/test/tickets/LDEV4866.cfc index b4ec1dc952..a34b4b6ae0 100644 --- a/test/tickets/LDEV4866.cfc +++ b/test/tickets/LDEV4866.cfc @@ -6,38 +6,36 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="query" { function run( testResults , testBox ) { describe( title='LDEV-4866' , body=function(){ it( title='test query parsing, /* */-' , body=function() { - ``` - -/* */- - ``` + doQuery("#chr(13)# /* */- "); + doQuery("#chr(13)# /* */- "); + doQuery("/* */-"); }); it( title='test query parsing, just a - whitespace' , body=function() { - ``` - - - - - ``` + doQuery("#chr(9)# - #chr(13)# "); }); it( title='test query parsing, just a -' , body=function() { - ``` - - - ``` + doQuery("-"); }); it( title='test query parsing, just a / whitespace' , body=function() { - ``` - - / - - ``` + doQuery("#chr(9)# / #chr(13)# "); }); it( title='test query parsing, just a /' , body=function() { - ``` - / - ``` + doQuery("/"); }); }); } + private function doQuery(sql){ + try { + query name="test" datasource="#ds#" params="#params#" { + echo( sql ); + } + } catch (e) { + if ( e.stackTrace.indexOf("lucee.runtime.exp.DatabaseException:") neq 0 ) + rethrow; + } + } + } \ No newline at end of file