Skip to content

Commit

Permalink
Merge pull request #2289 from MitrahSoft/LDEV-4771
Browse files Browse the repository at this point in the history
Added testcase for call a function with cfloop query in LDEV-4771
  • Loading branch information
zspitzer authored Feb 1, 2024
2 parents 5c4feb7 + 8a6be13 commit a673f6d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/tickets/LDEV4771.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
component extends="org.lucee.cfml.test.LuceeTestCase" skip=true {

function beforeAll(){
variables.uri = createURI("LDEV4771");
}
function run( testResults , testBox ) {
describe( "test case for LDEV-4771", function() {
it( title="checking to call a function with cfloop query", body=function( currentSpec ) {
var result = _InternalRequest(
template : "#uri#\LDEV4771.cfm"
);
expect( result.filecontent ).toBe("2221");
});
});
}

private string function createURI(string calledName){
var baseURI="/test/#listLast(getDirectoryFromPath(getCurrenttemplatepath()),"\/")#/";
return baseURI&""&calledName;
}

}
27 changes: 27 additions & 0 deletions test/tickets/LDEV4771/LDEV4771.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<cfscript>
qry = queryNew("id", "integer", [1]);
function f0(id) {
var a = [10];
a.each(function(item){
writeOutput(id);
var b = [20];
b.each(function(item){
writeOutput(id);
});
});
var f1 = function(){return id;}
writeOutput(f1() );
f2();
}
function f2() {
writeOutput(id);
}
cfloop (query=qry ) {
writeOutput(f0(id = 2));
};
</cfscript>

0 comments on commit a673f6d

Please sign in to comment.