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.)
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-
Kangmo commented at 12:43 AM on December 16, 2013: none
-
0205abd83d
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.)
-
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.
-
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.
-
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.
- laanwj referenced this in commit 3d7c66d75d on Dec 16, 2013
- laanwj merged this on Dec 16, 2013
- laanwj closed this on Dec 16, 2013
-
laanwj commented at 7:07 AM on December 16, 2013: member
Good idea
- DrahtBot locked this on Sep 8, 2021
Contributors