aboutsummaryrefslogtreecommitdiff
path: root/src/test/result_tests.cpp
AgeCommit message (Collapse)Author
2024-12-08Merge bitcoin/bitcoin#31306: ci: Update Clang in "tidy" jobmerge-script
31e59d94c67b58f24dd701fc7ccfee7d79f311cb iwyu: Drop backported mapping (Hennadii Stepanov) fe9bc5abef3dcbe0f6395c3233f9d122579cd1f0 ci: Update Clang in "tidy" job (Hennadii Stepanov) Pull request description: This PR switches to the latest [IWYU 0.23](https://github.com/include-what-you-use/include-what-you-use/releases/tag/0.23), which is compatible with Clang 19. New "bugprone-use-after-move" and "modernize-use-starts-ends-with" warnings that emerged have been addressed. ACKs for top commit: maflcko: lgtm ACK 31e59d94c67b58f24dd701fc7ccfee7d79f311cb l0rinc: ACK 31e59d94c67b58f24dd701fc7ccfee7d79f311cb theuni: ACK 31e59d94c67b58f24dd701fc7ccfee7d79f311cb Tree-SHA512: ae0ca150673e1bfa78664f2ef35dbc965094b32374cafeeae390c6d368c28169a7f7790debe9a6eeb5efc39c9a468f5032d92f30cc4032b09d8265f6a75de882
2024-12-05ci: Update Clang in "tidy" jobHennadii Stepanov
This change switches to the latest IWYU 0.23, which is compatible with Clang 19. Fixed new "modernize-use-starts-ends-with" warnings. The new "bugprone-use-after-move" warning in `result_tests.cpp` is a false positive caused by a bug in Boost.Test versions < 1.87. This has been addressed by introducing a local variable. See upstream references: - Issue: https://github.com/boostorg/test/issues/343 - Fix: https://github.com/boostorg/test/pull/348 Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
2024-12-04scripted-diff: Replace strprintf(Untranslated) with Untranslated(strprintf)Ryan Ofsky
This makes code more consistent and makes it easier to add compile-time checking to enforce that format strings contain the right specifiers, because it stops using Untranslated() to create the format string, so the Untranslated() function will not need to get involved in formatting. -BEGIN VERIFY SCRIPT- quote='"[^"]+"' quotes="(?:$quote|\\s)*" nonparens="[^()]*" single_level_paren="\($nonparens\)" double_level_paren="\($nonparens\($nonparens\)$nonparens\)" exprs="(?:$double_level_paren|$single_level_paren|$nonparens)*" git grep -l 'Untranslated' | xargs perl -0777 -i -pe "s/strprintf\((\\W*)Untranslated\(($quotes)\)($exprs)(\))/Untranslated(\1strprintf(\2\3))/gs" -END VERIFY SCRIPT-
2022-08-03refactor: Replace BResult with util::ResultRyan Ofsky
Rename `BResult` class to `util::Result` and update the class interface to be more compatible with `std::optional` and with a full-featured result class implemented in https://github.com/bitcoin/bitcoin/pull/25665. Motivation for this change is to update existing `BResult` usages now so they don't have to change later when more features are added in #25665. This change makes the following improvements originally implemented in #25665: - More explicit API. Drops potentially misleading `BResult` constructor that treats any bilingual string argument as an error. Adds `util::Error` constructor so it is never ambiguous when a result is being assigned an error or non-error value. - Better type compatibility. Supports `util::Result<bilingual_str>` return values to hold translated messages which are not errors. - More standard and consistent API. `util::Result` supports most of the same operators and methods as `std::optional`. `BResult` had a less familiar interface with `HasRes`/`GetObj`/`ReleaseObj` methods. The Result/Res/Obj naming was also not internally consistent. - Better code organization. Puts `src/util/` code in the `util::` namespace so naming reflects code organization and it is obvious where the class is coming from. Drops "B" from name because it is undocumented what it stands for (bilingual?) - Has unit tests.