Created
May 24, 2024 16:26
-
-
Save trycf/a65bbc77fd17fb68784e7030b61c5be5 to your computer and use it in GitHub Desktop.
TryCF Gist
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 assert( actual, expected ) { | |
var wanted = serializeJSON( expected ); | |
var got = serializeJSON( actual ); | |
if ( wanted == got ) { | |
writeOutput( "✔" ) | |
} else { | |
writeOutput( "✗" ) | |
} | |
writeOutput( " expected `#wanted#`, got `#got#`<br>" ); | |
if ( wanted != got ) { | |
writeDump( callstackget().pop() ) | |
} | |
} | |
someArray = ["1", "50", "100"]; | |
arraySort(someArray, "text", "asc"); | |
assert( someArray, ["1","100","50"] ); | |
someArray = ["1", "50", "100"]; | |
arraySort(someArray, "textnocase", "desc"); | |
assert( someArray, ["50","100","1"] ); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment