Commit b17f7ce63a3bab914ad1886667e03ed3acd2b2fc
Committed by
Henry Schreiner
1 parent
067bb43a
Adding a test for coverage
Showing
2 changed files
with
11 additions
and
10 deletions
scripts/clang-format-pre-commit
| ... | ... | @@ -9,13 +9,12 @@ format_file() { |
| 9 | 9 | file="${1}" |
| 10 | 10 | case "$file" in |
| 11 | 11 | *.hpp | *.cpp | .c | *.cc | *.cu | *.h ) |
| 12 | - echo "Formatting: $file" | |
| 13 | 12 | clang-format -i -style=file -sort-includes "${1}" |
| 14 | - if git diff-file --quiet -- "${1}" ; then | |
| 13 | + if git diff-files --quiet -- "${1}" ; then | |
| 14 | + echo "Already formatted: ${1}" | |
| 15 | + else | |
| 15 | 16 | git add "${1}" |
| 16 | 17 | echo "Reformatting file: ${1}" |
| 17 | - else | |
| 18 | - echo "Already formatted: ${1}" | |
| 19 | 18 | fi; |
| 20 | 19 | ;; |
| 21 | 20 | *) | ... | ... |
tests/CreationTest.cpp
| ... | ... | @@ -331,13 +331,15 @@ TEST_F(TApp, OptionFromDefaultsSubcommands) { |
| 331 | 331 | EXPECT_EQ(app2->option_defaults()->get_group(), "Something"); |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | -TEST_F(TApp, HelpFlagFromDefaultsSubcommands) { | |
| 335 | - app.set_help_flag("--that", "Wow"); | |
| 336 | - | |
| 337 | - auto app2 = app.add_subcommand("app2"); | |
| 334 | +TEST_F(TApp, GetNameCheck) { | |
| 335 | + int x; | |
| 336 | + auto a = app.add_flag("--that"); | |
| 337 | + auto b = app.add_flag("-x"); | |
| 338 | + auto c = app.add_option("pos", x); | |
| 338 | 339 | |
| 339 | - EXPECT_EQ(app2->get_help_ptr()->get_name(), "--that"); | |
| 340 | - EXPECT_EQ(app2->get_help_ptr()->get_description(), "Wow"); | |
| 340 | + EXPECT_EQ(a->get_name(), "--that"); | |
| 341 | + EXPECT_EQ(b->get_name(), "-x"); | |
| 342 | + EXPECT_EQ(c->get_name(), "pos"); | |
| 341 | 343 | } |
| 342 | 344 | |
| 343 | 345 | TEST_F(TApp, SubcommandDefaults) { | ... | ... |