http://d.puremagic.com/issues/show_bug.cgi?id=4653
--- Comment #8 from Andrej Mitrovic <[email protected]> 2013-02-25 14:48:41 PST --- I don't know whether assertEqual and other others will ever get in (assertThrown/assertNotThrown did), but the implementation can be seriously simplified. Here's an example of some assert functions (without a custom user message, but that could be easily added): import core.exception; import std.string; template assertOp(string op) { void assertOp(T1, T2)(T1 lhs, T2 rhs, string file = __FILE__, size_t line = __LINE__) { string msg = format("(%s %s %s) failed.", lhs, op, rhs); mixin(format(q{ if (!(lhs %s rhs)) throw new AssertError(msg, file, line); }, op)); } } alias assertOp!"==" assertEqual; alias assertOp!"!=" assertNotEqual; alias assertOp!">" assertGreaterThan; alias assertOp!">=" assertGreaterThanOrEqual; unittest { assertEqual(1, 1); assertNotEqual(1, 2); assertGreaterThan(2, 1); assertGreaterThanOrEqual(2, 2); } That's a huge save of line numbers. Admittedly both of us have learned a few tricks since 2010. :) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
