ceylon-sdk
ceylon-sdk copied to clipboard
ceylon test: Include line numbers for failures
I'd like to see line numbers for failures in the test reports:
[ceylon-test] test.ceylon.math::power - failure (ceylon.language.AssertionError "Assertion failed: exponent must be non-negative
[ceylon-test] violated other>=0")
[ceylon-test] test.ceylon.math::wholeTests - failure (ceylon.language.AssertionError "Assertion failed: exponent must be non-negative
[ceylon-test] violated !other.negative")
[ceylon-test] test.ceylon.net::testGETAndParseJSON - failure (ceylon.test.AssertionComparisonError "Object size: 70 != 69")
Currently, there is no equivalent to java Throwable.getStackTrace()
, so I would have to print stack trace to StringBuilder
and parse first lines :-(.
Can we add similar api into Throwable
?
@thradec Well the issue is how would that be implemented in JavaScript?
Maybe there is some way http://www.eriwen.com/javascript/js-stack-trace, but @chochos would know more. In any case, if this won't be supported by language, I can hardly implement it myself.
Possibly there is a way to extract the source file and line number.
Right, so this is a question for @chochos then ;)
Will ceylon/ceylon-js#67 be useful for this?
I try to extract line numbers from the generated sources when printing exception stack traces, but there's currently no way of getting source line numbers. The source maps thing is going to be useful in browsers, but decoding that data ourselves is not trivial at all.
How do you extract them, then? If you do extract them, it means we can make them accessible, no? Even if it's crude.
Not for 1.1, I suppose.