From c6cf313ff3ef51d2f0dbcce1980a52c81ad1d61f Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Mon, 25 Nov 2024 12:57:54 +0100 Subject: [PATCH] test cleanup, avoid crash when reflection disabled --- test/tickets/LDEV1770.cfc | 96 ++++++++++++++++++++------------------- test/tickets/LDEV2113.cfc | 8 ++-- 2 files changed, 54 insertions(+), 50 deletions(-) diff --git a/test/tickets/LDEV1770.cfc b/test/tickets/LDEV1770.cfc index 2b13d1e399..897bcf86ea 100644 --- a/test/tickets/LDEV1770.cfc +++ b/test/tickets/LDEV1770.cfc @@ -1,53 +1,55 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="xml"{ function run( testResults , testBox ) { describe( "Test suite for LDEV-1770", function() { - var getArt= QueryNew( "ARTID,ARTNAME,DESCRIPTION,ISSOLD,MEDIATYPE" ); - QueryAddRow( getArt, 3 ); - - QuerySetCell( getArt, "ARTID", "1", 1 ); - QuerySetCell( getArt, "DESCRIPTION", "Test desc 1", 1 ); - QuerySetCell( getArt, "ARTNAME", "Picaso 1", 1 ); - - QuerySetCell( getArt, "ARTID", "2", 2 ); - QuerySetCell( getArt, "DESCRIPTION", "Test desc 2", 2 ); - QuerySetCell( getArt, "ARTNAME", "Picaso 2", 2 ); - - QuerySetCell( getArt, "ARTID", "3", 3 ); - QuerySetCell( getArt, "DESCRIPTION", "Test desc 3", 3 ); - QuerySetCell( getArt, "ARTNAME", "Picaso 3", 3 ); - - var feedMeta = structNew(); - var feedMeta.description = "ColdFusion Art Gallery XML Feed"; - var feedMeta.link = "http://coldfusionexamples.com/"; - var feedMeta.title = "Art"; - var feedMeta.version = "rss_2.0"; - - var colMap = structNew(); - var colMap.content = "DESCRIPTION"; - var colMap.rsslink = "ARTID"; - var colMap.title = "ARTNAME"; - - cffeed (action="create" query="#getArt#" columnMap="#colMap#" properties="#feedMeta#" xmlVar="feedXML"); - var testContent = xmlParse(feedXML); - - it( title="Checking 'item' with 'title' node as empty ", body=function( currentSpec ) { - local.result = testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren[1].XmlText; - expect(local.result).toBe('Picaso 1'); - }); - - xit( title="Checking 'item' with 'desc' node as empty", body=function( currentSpec ) { - local.result = testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren[2].XmlText; - expect(local.result).toBe('1'); - }); - - xit( title="Checking 'item' contains 'link' node", body=function( currentSpec ) { - local.result = testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren[2].xmlName; - expect(local.result).toBe('link'); - }); - - it( title="Checking 'item' contains three nodes", body=function( currentSpec ) { - local.result = arrayLen(testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren); - expect(local.result).toBe('3'); + it(title="Checking the CFFEED tag", body=function( currentSpec ) { + var getArt= QueryNew( "ARTID,ARTNAME,DESCRIPTION,ISSOLD,MEDIATYPE" ); + QueryAddRow( getArt, 3 ); + + QuerySetCell( getArt, "ARTID", "1", 1 ); + QuerySetCell( getArt, "DESCRIPTION", "Test desc 1", 1 ); + QuerySetCell( getArt, "ARTNAME", "Picaso 1", 1 ); + + QuerySetCell( getArt, "ARTID", "2", 2 ); + QuerySetCell( getArt, "DESCRIPTION", "Test desc 2", 2 ); + QuerySetCell( getArt, "ARTNAME", "Picaso 2", 2 ); + + QuerySetCell( getArt, "ARTID", "3", 3 ); + QuerySetCell( getArt, "DESCRIPTION", "Test desc 3", 3 ); + QuerySetCell( getArt, "ARTNAME", "Picaso 3", 3 ); + + var feedMeta = structNew(); + var feedMeta.description = "ColdFusion Art Gallery XML Feed"; + var feedMeta.link = "http://coldfusionexamples.com/"; + var feedMeta.title = "Art"; + var feedMeta.version = "rss_2.0"; + + var colMap = structNew(); + var colMap.content = "DESCRIPTION"; + var colMap.rsslink = "ARTID"; + var colMap.title = "ARTNAME"; + + cffeed (action="create" query="#getArt#" columnMap="#colMap#" properties="#feedMeta#" xmlVar="feedXML"); + var testContent = xmlParse(feedXML); + + it( title="Checking 'item' with 'title' node as empty ", body=function( currentSpec ) { + local.result = testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren[1].XmlText; + expect(local.result).toBe('Picaso 1'); + }); + + xit( title="Checking 'item' with 'desc' node as empty", body=function( currentSpec ) { + local.result = testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren[2].XmlText; + expect(local.result).toBe('1'); + }); + + xit( title="Checking 'item' contains 'link' node", body=function( currentSpec ) { + local.result = testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren[2].xmlName; + expect(local.result).toBe('link'); + }); + + it( title="Checking 'item' contains three nodes", body=function( currentSpec ) { + local.result = arrayLen(testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren); + expect(local.result).toBe('3'); + }); }); }); } diff --git a/test/tickets/LDEV2113.cfc b/test/tickets/LDEV2113.cfc index 446d1cfb71..01f8d82031 100644 --- a/test/tickets/LDEV2113.cfc +++ b/test/tickets/LDEV2113.cfc @@ -1,6 +1,6 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="xml" { - variables.xml=xmlparse(' + variables.xml=' 1 9.90 -'); +'; variables.schema=' '; - + function beforeAll(){ + variables.xml = xmlParse( variables.xml ); + }; function run( testResults , testBox ) { describe( "test case for LDEV-2113", function() {