diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-09-08 23:09:21 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-09-08 23:09:37 +0200 |
| commit | 677265461b3c596ab2a88858e74b0970196198fe (patch) | |
| tree | 40cb1e82e78221dad294b9a521024936c2b716bc /test/args.cc | |
| parent | bf900719174913774e9559302ac90e11c68ac87a (diff) | |
Make clang-tidy happy
Diffstat (limited to 'test/args.cc')
| -rw-r--r-- | test/args.cc | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/test/args.cc b/test/args.cc index b60a4a4..a43c59c 100644 --- a/test/args.cc +++ b/test/args.cc @@ -2,25 +2,33 @@ #include "args.hh" +#include <cstddef> +#include <memory> +#include <sstream> +#include <string> +#include <string_view> +#include <utility> +#include <vector> + #define SETUP_OPTIONS(args) \ - auto short_only = args->option('a', "", "an option"); \ - auto short_long = args->option('b', "bold", "set font style to bold"); \ - auto long_only = args->option("cold", "use if it is cold outside"); \ - auto short_only_req = args->option_argument('d', "", "", "distance"); \ - auto short_long_req = args->option_argument('e', "eat", "FOOD", \ - "what to order, what to eat?"); \ - auto long_only_req = args->option_argument( \ + auto short_only = (args)->option('a', "", "an option"); \ + auto short_long = (args)->option('b', "bold", "set font style to bold"); \ + auto long_only = (args)->option("cold", "use if it is cold outside"); \ + auto short_only_req = (args)->option_argument('d', "", "", "distance"); \ + auto short_long_req = (args)->option_argument( \ + 'e', "eat", "FOOD", "what to order, what to eat?"); \ + auto long_only_req = (args)->option_argument( \ "form", "", "circle, shape or something else?"); \ - auto short_only_opt = args->option_argument('g', "", "", "", false); \ - auto short_long_opt = args->option_argument('h', "hold", "", "", false); \ - auto long_only_opt = args->option_argument("invert", "", "", false); + auto short_only_opt = (args)->option_argument('g', "", "", "", false); \ + auto short_long_opt = (args)->option_argument('h', "hold", "", "", false); \ + auto long_only_opt = (args)->option_argument("invert", "", "", false); namespace { class Arguments { public: - int c() const { return static_cast<int>(str_.size()); }; - char** v() const { return ptr_.get(); } + [[nodiscard]] int c() const { return static_cast<int>(str_.size()); }; + [[nodiscard]] char** v() const { return ptr_.get(); } explicit Arguments(std::vector<std::string> str) : str_(std::move(str)) { @@ -45,7 +53,7 @@ class Builder { } Builder& add(std::string str) { - str_.push_back(std::move(str)); + str_.emplace_back(std::move(str)); return *this; } |
