ceylon-sdk icon indicating copy to clipboard operation
ceylon-sdk copied to clipboard

ceylon test: Include line numbers for failures

Open FroMage opened this issue 10 years ago • 9 comments

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")

FroMage avatar May 16 '14 11:05 FroMage

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 avatar May 16 '14 19:05 thradec

@thradec Well the issue is how would that be implemented in JavaScript?

gavinking avatar May 17 '14 06:05 gavinking

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.

thradec avatar May 17 '14 10:05 thradec

Possibly there is a way to extract the source file and line number.

gavinking avatar May 17 '14 10:05 gavinking

Right, so this is a question for @chochos then ;)

FroMage avatar May 19 '14 07:05 FroMage

Will ceylon/ceylon-js#67 be useful for this?

lucaswerkmeister avatar May 21 '14 09:05 lucaswerkmeister

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.

chochos avatar May 21 '14 22:05 chochos

How do you extract them, then? If you do extract them, it means we can make them accessible, no? Even if it's crude.

FroMage avatar May 22 '14 08:05 FroMage

Not for 1.1, I suppose.

gavinking avatar Sep 19 '14 15:09 gavinking