Opened 15 years ago

Closed 14 years ago

#3091 closed enhancement (fixed)

[patch] have doh complain when assert functions are misused

Reported by: skinner Owned by: alex
Priority: lowest Milestone:
Component: TestFramework Version: 0.9
Keywords: Cc:
Blocked By: Blocking:


In the unit tests, we've accidentally had some test cases where the test passes without really doing the check that the test case was designed to check.

The problem happens as a result of a copy/paste error, where an existing assertTrue or assertFalse line was copied as a starter to make a new assertEqual statement, but the function name was never changed, so we accidentally ended up with a line like this:

t.assertTrue("red", currentColor);

instead of the intended line:

t.assertEqual("red", currentColor);

Doh could easily check for that sort of accidental misuse of the test function. I'll attach a patch that adds error checking to assertTrue and assertFalse to check that they are only passed one arg at a time.

Attachments (1)

doh_runner_arg_length_check.patch (860 bytes) - added by skinner 15 years ago.

Download all attachments as: .zip

Change History (2)

Changed 15 years ago by skinner

comment:1 Changed 14 years ago by alex

Resolution: fixed
Status: newclosed

(In [10946]) Merging patch from Brian Skinner to check args for assert* functions. Fixes #3091

Note: See TracTickets for help on using tickets.