Skip to main content

Bug Tracker

Side navigation

#4318 closed feature (invalid)

Opened March 10, 2009 08:45AM UTC

Closed February 05, 2010 09:38PM UTC

"raises" assertion for exception handling

Reported by: FND Owned by: joern
Priority: major Milestone:
Component: qunit Version:
Keywords: Cc:
Blocked by: Blocking:

As suggested here, QUnit could be extended with a

assertion to test for the occurrence of exceptions.

The attached patch allows writing tests like the following:

var expression, expected;

// should pass
expression = function() { return; };
expected = "TypeError";
throwsEx(expression, expected, "invalid property access raises
TypeError exception");

// should fail
expression = function() { var foo = {}; return; };
expected = "NoneError";
throwsEx(expression, expected, "property access raises NoneError

(Note that these tests use closures to wrap around the expressions which are actually being tested.)

Attachments (1)
Change History (1)

Changed February 05, 2010 09:38PM UTC by john comment:1

resolution: → invalid
status: newclosed

We're moving QUnit-related bugs off to the new QUnit issue tracker:

Please re-post the issue there.