Improve unit test code not to compare explanatory messages directly. #3423

pull Kangmo wants to merge 1 commits into bitcoin:master from Kangmo:kangmo-unit-test-fix changing 1 files +6 −4
  1. Kangmo commented at 12:43 AM on December 16, 2013: none

    Instead, use an exception object to check if the string returned by what() on the raised exception matches the string returned by what() on the expected exception instance. This way, we do not need to list all different possible explanatory strings for different platforms in the test code, and make it simple. (The idea is from Cory Fields.)

  2. Improve unit test code not to compare with explanatory messages for each platform.
    Instead, use have an exception object to check if the string returned by what() on the raised exception matches the string returned by what() on the expected exception instance.
    This way, we do not need to list all different possible explanatory strings for different platforms in the test code, and make it simple. (The idea is by Cory Fields.)
    0205abd83d
  3. BitcoinPullTester commented at 1:15 AM on December 16, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/0205abd83d8f8dcbe453440a3fa4e494b71704e8 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  4. theuni commented at 2:23 AM on December 16, 2013: member

    Much better, thanks :) You could make expectedException static const, but since it's just a test it's really not worth much thought.

    +1 either way.

  5. Kangmo commented at 2:38 AM on December 16, 2013: none

    Good point! You are one step faster than me ;-).

    Thanks for the advice, theuni.

  6. laanwj referenced this in commit 3d7c66d75d on Dec 16, 2013
  7. laanwj merged this on Dec 16, 2013
  8. laanwj closed this on Dec 16, 2013

  9. laanwj commented at 7:07 AM on December 16, 2013: member

    Good idea

  10. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-29 03:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me