Re: Catch block not hit in unittest

2016-11-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, November 24, 2016 15:41:12 Lucia Cojocaru via Digitalmars-d- learn wrote: > I was able to hack my way around it. In druntime there are other > modules which need the exact same thing and have their own > assertThrown template: >

Re: Catch block not hit in unittest

2016-11-24 Thread Lucia Cojocaru via Digitalmars-d-learn
On Thursday, 24 November 2016 at 14:47:32 UTC, Jonathan M Davis wrote: On Thursday, November 24, 2016 13:42:25 Kagamin via Digitalmars-d-learn wrote: Linux? Probably another bug. Try this: unittest { import core.exception : UnicodeException; void f() { string ret;

Re: Catch block not hit in unittest

2016-11-24 Thread Lucia Cojocaru via Digitalmars-d-learn
On Thursday, 24 November 2016 at 15:18:40 UTC, Ryan wrote: On Thursday, 24 November 2016 at 13:42:25 UTC, Kagamin wrote: Linux? Probably another bug. Try this: unittest { import core.exception : UnicodeException; void f() { string ret; int i = -1; ret ~= i;

Re: Catch block not hit in unittest

2016-11-24 Thread Ryan via Digitalmars-d-learn
On Thursday, 24 November 2016 at 13:42:25 UTC, Kagamin wrote: Linux? Probably another bug. Try this: unittest { import core.exception : UnicodeException; void f() { string ret; int i = -1; ret ~= i; } try { f(); }

Re: Catch block not hit in unittest

2016-11-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, November 24, 2016 13:42:25 Kagamin via Digitalmars-d-learn wrote: > Linux? Probably another bug. > Try this: > unittest > { > import core.exception : UnicodeException; > void f() > { > string ret; > int i = -1; > ret ~= i; > } > >

Re: Catch block not hit in unittest

2016-11-24 Thread Kagamin via Digitalmars-d-learn
Linux? Probably another bug. Try this: unittest { import core.exception : UnicodeException; void f() { string ret; int i = -1; ret ~= i; } try { f(); } catch(UnicodeException e) { assert(e.msg == "Invalid UTF-8

Catch block not hit in unittest

2016-11-24 Thread Lucia Cojocaru via Digitalmars-d-learn
Hello, I am trying to assert the fact that a UnicodeException is thrown by the piece of code added in this PR: https://github.com/dlang/druntime/pull/1696/files The unittest is in druntime/src/rt/lifetime.d: unittest { import core.exception : UnicodeException; try {