Created
January 11, 2018 15:03
-
-
Save aliaspooryorik/ec5d441607d0c5312a3f6bc5af5a4c5e to your computer and use it in GitHub Desktop.
callStackGet - stolen from Ryan Guill
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
private function expect (required any testValue, required any targetValue, string message = "") { | |
arguments.message &= "<br /> expected [" & encodeForHtml(toString(arguments.targetValue)) & "] <br /> but received [" & encodeForHtml(toString(testValue)) & "] <br />"; | |
if (arguments.testValue != arguments.targetValue) { | |
var cs = callStackGet(); | |
var lineRef = ""; | |
for (var line in cs) { | |
if (structKeyExists(line, "Function") && line["Function"] == getFunctionCalledName()) { | |
continue; | |
} | |
if (structKeyExists(line, "Template")) { | |
lineRef = lineRef & "<br />" & line["Template"]; | |
} | |
if (structKeyExists(line, "LineNumber")) { | |
lineRef = lineRef & ":" & line["LineNumber"]; | |
} | |
break; | |
} | |
assert(false, '<pre>' & arguments.message & trim(lineRef) & '</pre>'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment