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> | |
CR = chr(13); | |
LF = chr(10); | |
CRLF = CR&LF; | |
for (LB in [CR,LF,CRLF,LF & CR & LF]){ | |
original = "#LB#front text#LB#back text#LB#"; | |
trimmed = trim(original); | |
writeDump(var=[urlEncodedFormat(original), urlEncodedFormat(trimmed)]); | |
} |
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
<!--- runTests.cfm ---> | |
<cfoutput> | |
#new mxunit.runner.DirectoryTestSuite().run( | |
directory = getDirectoryFromPath(getCurrentTemplatePath()) | |
).getResultsOutput("html")# | |
</cfoutput> |
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
// Test.cfc | |
component extends="mxunit.framework.TestCase" { | |
public void function beforeTests(){ | |
addAssertDecorator("CustomAssertions"); | |
include "./function.cfm"; | |
} | |
public void function setup(){ | |
variables.eventObject = createEventObject(); |
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
// CustomAssertions.cfc | |
component { | |
public void function assertStructKeysCorrect(required string keys, required struct struct, string message){ | |
var assertionArgs = { | |
expected = listSort(keys, "textnocase"), | |
actual = listSort(structKeyList(struct), "textnocase") | |
}; | |
if (structKeyExists(arguments, "message")){ | |
assertionArgs.message = 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
<cfscript> | |
testNumbers = [ | |
"0", "0.0", "0.00", "0.000", "0.001", | |
"0.1", "0.10", "0.100", "0.101", | |
"0.11", "0.110", "0.111" | |
]; | |
function formatter(n){ | |
var formattedN = n; |
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 { | |
variables.where = "in component"; | |
{ | |
public function hello() { | |
writeOutput(variables.where & "<br>"); | |
return "Hello<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
// Application.cfc | |
component { | |
this.mappings = { | |
"/testbox" = expandPath("/frameworks/testbox/"), | |
"/mxunit" = expandPath("/frameworks/testbox/system/testing/compat"), | |
"/unittests" = expandPath("/shared/git/blogExamples/unittests") | |
}; | |
} |
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
// Application.cfc | |
component { | |
this.mappings = { | |
"/testbox" = expandPath("/frameworks/testbox/"), | |
"/mxunit" = expandPath("/frameworks/testbox/system/testing/compat"), | |
"/unittests" = expandPath("/shared/git/blogExamples/unittests") | |
}; | |
} |
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
// Application.cfc | |
component { | |
this.name = "testRest06"; | |
function onApplicationStart(){ | |
writeLog(file=this.name, text="#getFunctionCalledName()#() called"); | |
} | |
function onApplicationEnd(){ |
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
cffileRead: [abcdefghijklmnopqrstuvwxy*()__+[]\{}|;':",./<>?] | |
cfloopRead: [abcdefghijklmnopqrstuvwxy*()__+[]\{}|;':",./<>?] | |
EQ: NO | |
compare: -1 | |
len: cffileRead: 47; cfloopRead: 48 | |
i char from cffileRead char from cfloopRead | |
1 a (97) (65279) | |
2 b (98) a (97) |