Page MenuHomePhabricator

Make assertTrue() / assertFalse() messages more descriptive
ClosedPublic

Authored by epriestley on Mar 9 2014, 3:08 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 19, 8:44 PM
Unknown Object (File)
Sun, Dec 15, 5:59 PM
Unknown Object (File)
Fri, Dec 6, 4:03 AM
Unknown Object (File)
Tue, Dec 3, 5:33 PM
Unknown Object (File)
Nov 21 2024, 11:30 AM
Unknown Object (File)
Nov 16 2024, 9:21 PM
Unknown Object (File)
Nov 10 2024, 8:08 AM
Unknown Object (File)
Nov 10 2024, 6:32 AM
Subscribers

Details

Summary

See discussion in D8460. Primarily, this prints out the failing value when a true/false assertion fails, so if it was something useful (like a function result) it's visible.

Test Plan

Added assertTrue("quack"):

   FAIL  ArcanistDiffParserTestCase::testParser
Assertion failed, expected 'true' (at ArcanistDiffParserTestCase.php:16).

ACTUAL VALUE
quack

Added assertFalse("quack"):

   FAIL  ArcanistDiffParserTestCase::testParser
Assertion failed, expected 'false' (at ArcanistDiffParserTestCase.php:16).

ACTUAL VALUE
quack

Added assertEqual("quack", "moo"):

   FAIL  ArcanistDiffParserTestCase::testParser
Assertion failed, expected values to be equal (at ArcanistDiffParserTestCase.php:16).
Expected: quack
  Actual: moo

Diff Detail

Repository
rARC Arcanist
Branch
verbassert
Lint
Lint Passed
Unit
Tests Passed

Event Timeline

joshuaspence edited edge metadata.

Yeah, this makes sense.

This revision is now accepted and ready to land.Mar 9 2014, 3:22 AM

90% of the time it's probably not useful (especially if you're judicious about assertEqual() even when the expected parameter is false), but I think it's never really worse.

epriestley updated this revision to Diff 20075.

Closed by commit rARCa90a72c648ac (authored by @epriestley).