This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It returns true when the test function is defined as a function statement inline | |
Result: OK | |
It returns true when the test function is defined as a function expression inline | |
Result: OK | |
It returns true when the test function is defined as a tag island inline | |
Result: Expected: [true]; received: [] | |
It returns true when the test function is defined as a tag island not inline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
function function createIdSequence(required string prefix){ | |
var counters[prefix] = counters[prefix] ?: 1 | |
var generators[prefix] = generators[prefix] ?: () => prefix & counters[prefix]++ | |
return generators[prefix] | |
} | |
getNewSubscriptionID = createIdSequence("SUB") | |
getNewMandateID = createIdSequence("MND") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
runTest("it uses a function called runTest", ()=>{}) | |
savecontent variable="testOutput" { | |
runTest("runTest requires and displays a passed-in message describing the test, followed by a line break", ()=>{}) | |
} | |
writeOutput(testOutput) | |
if (testOutput != "runTest requires and displays a passed-in message describing the test, followed by a line break<br>") { | |
throw(type="AssertionException", message="runTest did not output the message and line break") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
runTest("default struct deferencing works the same as with dot operator", () => { | |
var st = {key="value"} | |
assertEqual(st.key, st?.key) | |
}) | |
runTest("null left-hand operand does error with . operator", () => { | |
assertException(() => { | |
var result = st.key | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
function runTest(required string label, required function testCase) { | |
try { | |
writeOutput("#label#: ") | |
testCase() | |
writeOutput("OK") | |
} catch("AssertionException" e) { | |
writeOutput("Failure: #e.message#") | |
} catch(any e) { | |
writeOutput("Error: #e.message#") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cferror template="./outputError.cfm" type="request"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component { | |
function onError(exception) { | |
writeOutput("Message: #exception.message#<br>") | |
writeOutput("Type: #exception.type#<br>") | |
writeOutput("Detail: #exception.detail#<br>") | |
abort | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C2.cfc | |
component { | |
public static final string function g() { | |
return getFunctionCalledName(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Base.cfc | |
component { | |
writeOutput("Top of pseudo-constructor of #getMetadata(this).name#<br>") | |
exit; | |
writeOutput("Bottom of pseudo-constructor of #getMetadata(this).name#<br>") | |
function init() { | |
writeOutput("In #getMetadata(this).name#.#getFunctionCalledName()#<br>") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Base.cfc | |
component { | |
writeOutput("Top of pseudo-constructor of #getMetadata(this).name#<br>") | |
exit; | |
writeOutput("Bottom of pseudo-constructor of #getMetadata(this).name#<br>") | |
function init() { | |
writeOutput("In #getMetadata(this).name#.#getFunctionCalledName()#<br>") | |
} | |
} |