This wraps the duplicated code in src/test/transaction_tests.cpp of the test tx_valid and tx_invalid in a static function for_each_test.
Easier to review with git diff --color-moved=zebra --ignore-space-change HEAD~
refactor: Remove duplicated test code #26246
pull aureleoules wants to merge 1 commits into bitcoin:master from aureleoules:2022-10-refactor-duplicated-test-code changing 1 files +81 −107-
aureleoules commented at 1:31 PM on October 4, 2022: member
- fanquake added the label Tests on Oct 4, 2022
-
DrahtBot commented at 8:28 PM on October 4, 2022: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #22954 ([TESTS] Allow tx_invalid.json tests to include flag rules for if_unset: [A,B,C] then_unset: [D] by JeremyRubin)
- #22876 ([TESTS] Update Transaction Tests to permit setting a flag as always on and disabling the exhaustive failure test by JeremyRubin)
- #22338 ([Refactor]: Rename Script methods that only work on PreTapScript scripts by sanket1729)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
- aureleoules force-pushed on Oct 5, 2022
-
in src/test/transaction_tests.cpp:190 in 2e9a8536ac outdated
191 | -{ 192 | - BOOST_CHECK_MESSAGE(CheckMapFlagNames(), "mapFlagNames is missing a script verification flag"); 193 | - // Read tests from test/data/tx_valid.json 194 | - UniValue tests = read_json(std::string(json_tests::tx_valid, json_tests::tx_valid + sizeof(json_tests::tx_valid))); 195 | - 196 | +static void for_each_test(UniValue tests, std::function<void(const UniValue& test, CTransaction& tx, std::map<COutPoint, CScript>& mapprevOutScriptPubKeys, std::map<COutPoint, int64_t>& mapprevOutValues)> test_fun) {
yancyribbens commented at 11:42 AM on October 6, 2022:The developer docs prefer 100 line column max if possible source.
glozow removed the label Tests on Oct 6, 2022glozow added the label Refactoring on Oct 6, 2022refactor: Remove duplicated test code e747705a12aureleoules force-pushed on Oct 6, 2022aureleoules closed this on Oct 12, 2022aureleoules deleted the branch on Nov 2, 2022bitcoin locked this on Nov 2, 2023ContributorsLabels
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-21 18:13 UTC
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-21 18:13 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me