Skip to content

Instantly share code, notes, and snippets.

@roryl
Last active January 14, 2017 16:31
Show Gist options
  • Save roryl/115e0f98612e1334fc94549a2d3d820b to your computer and use it in GitHub Desktop.
Save roryl/115e0f98612e1334fc94549a2d3d820b to your computer and use it in GitHub Desktop.
Lucee 5 Lambda Examples
<cfscript>
myclosure = function(){
return "foo"
}
echo(myClosure());
</cfscript>
<cfscript>
myclosure = () => "foo"
echo(myClosure());
</cfscript>
/**
* My xUnit Test
*/
component extends="testbox.system.BaseSpec"{
/*********************************** LIFE CYCLE Methods ***********************************/
// executes before all test cases
function beforeTests(){
}
// executes after all test cases
function afterTests(){
}
// executes before every test case
function setup( currentMethod ){
}
// executes after every test case
function teardown( currentMethod ){
}
/*********************************** TEST CASES BELOW ***********************************/
// Remember that test cases MUST start or end with the keyword 'test'
function testBasicClosure() test{
include template="/examples/lambdas/closure.cfm";
expect(isClosure(myClosure)).toBeTrue();
}
// Remember that test cases MUST start or end with the keyword 'test'
function testBasicLambda() test{
include template="/examples/lambdas/lambda.cfm";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment