This file contains hidden or 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> | |
| s1 = "ABCDEF".mid(1,3) | |
| s2 = "DEFABC".mid(4,6) | |
| writeOutput(s1 & "<br>") // ABC | |
| writeOutput(s2 & "<br>") // ABC | |
| writeOutput("<br>") | |
| writeOutput((s1 == s2) & "<br>") // true | |
| writeOutput((s1 === s2) & "<br>") // true (FALSE ON LUCEE) |
This file contains hidden or 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
| import test.BaseSpec | |
| component extends=BaseSpec { | |
| function run() { | |
| describe("Tests TestBox assertions", () => { | |
| describe("Tests toThrow", () => { | |
| it("should pass because it DOES throw an exception with the matching message", () => { | |
| expect(() => throwExceptionWithMatchingMessage()).toThrow(regex="^.*MATCH_THIS.*$") | |
| }) |
This file contains hidden or 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> | |
| serverDetails = { | |
| server="ftp.dlptest.com", | |
| username="dlpuser", | |
| password="rNrKYTX9g7z3RgJRmxWuGHbeu" | |
| } | |
| function usingClassicMode() localmode="classic" { | |
| cfftp(connection="c1", action="open", attributeCollection=serverDetails) | |
| cfftp(connection="c2", action="open", attributeCollection=serverDetails, result="c2ConnectionResult") |
This file contains hidden or 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
| import test.BaseSpec | |
| component extends=BaseSpec { | |
| function run() { | |
| describe("Trying to capture stdout", () => { | |
| var fixtures = {} | |
| aroundEach((spec) => { |
This file contains hidden or 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
| // CHANGES ONLY | |
| component { | |
| // ... | |
| // Setup Request Utilities | |
| if ( !request.keyExists( "testbox" ) ) { | |
| request.testbox = { | |
| "console" : variables.console, | |
| "debug" : () => debugFixed(argumentCollection=arguments, thisContext=this), // FIXED |
This file contains hidden or 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 { | |
| request.testBox.debug("in pseudo constructor") | |
| static { | |
| request.testBox.debug("in static constructor") | |
| } | |
| function init() { | |
| request.testBox.debug("in constructor") |
This file contains hidden or 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
| describe "Lifecycle function tests" do | |
| test_array = [] | |
| before(:all) do | |
| test_array.push "main block before :all handler" | |
| end | |
| before(:each) do # or just before with no param | |
| test_array.push "main block before :each handler" | |
| end |
This file contains hidden or 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 run() { | |
| describe("email address tests", () => { | |
| tests = [ | |
| {label="local too long (fails on CF)", expectation=false, address="#repeatString('x', 65)#@example.com"}, | |
| {label="domain too long (fails on CF)", expectation=false, address="x@#repeatString('x', 255)#.com"}, | |
| {label="embedded % should be fine (fails on both)", expectation=false, address="first%[email protected]"}, | |
| {label="domain format, length and overall length max (both pass)", expectation=true, address="x@x23456789ABCDEF-x23456789ABCDEF-x23456789ABCDEF-x23456789ABCDEF.x23456789ABCDEF-x23456789ABCDEF-x23456789ABCDEF-x23456789ABCDEF.x23456789ABCDEF-x23456789ABCDEF-x23456789ABCDEF-x23456789ABCDEF.x23456789ABCDEF-x23456789ABCDEF-x23456789ABCDEF-x2345678.com"}, | |
| {label="domain label length bad (first one 64 chars; max is 63) (fails on both)", expectation=false, address="x@XX23456789ABCDEF-x23456789ABCDEF-x23456789ABCDEF-x23456789ABCDEF.x23456789ABCDEF-x23456789ABCD |
This file contains hidden or 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> | |
| uuid = replace(createUuid(), "-", "", "ALL"); | |
| result64 = baseMToBaseN(uuid, "HEX", "BASE62"); | |
| result36 = baseMToBaseN(uuid, "HEX", "BASE36"); | |
| uuidAgain = baseMToBaseN(result64, "BASE62", "HEX"); | |
| writeDump([uuid, result64, result64.len(), uuidAgain, result36, result36.len()]); |
This file contains hidden or 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 { | |
| include "m.cfm"; | |
| } |