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
  1. aureleoules commented at 1:31 PM on October 4, 2022: member

    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~

  2. fanquake added the label Tests on Oct 4, 2022
  3. 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.

  4. aureleoules force-pushed on Oct 5, 2022
  5. 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.

  6. glozow removed the label Tests on Oct 6, 2022
  7. glozow added the label Refactoring on Oct 6, 2022
  8. refactor: Remove duplicated test code e747705a12
  9. aureleoules force-pushed on Oct 6, 2022
  10. aureleoules closed this on Oct 12, 2022

  11. aureleoules deleted the branch on Nov 2, 2022
  12. bitcoin locked this on Nov 2, 2023

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 site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me