Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trycf/8b28718a1e28ff6a879ad23deecc79a5 to your computer and use it in GitHub Desktop.
Save trycf/8b28718a1e28ff6a879ad23deecc79a5 to your computer and use it in GitHub Desktop.
TryCF Gist
<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