diff --git a/scripts/clang-format-pre-commit b/scripts/clang-format-pre-commit index d4f64b8d..812eee48 100755 --- a/scripts/clang-format-pre-commit +++ b/scripts/clang-format-pre-commit @@ -9,13 +9,12 @@ format_file() { file="${1}" case "$file" in *.hpp | *.cpp | .c | *.cc | *.cu | *.h ) - echo "Formatting: $file" clang-format -i -style=file -sort-includes "${1}" - if git diff-file --quiet -- "${1}" ; then + if git diff-files --quiet -- "${1}" ; then + echo "Already formatted: ${1}" + else git add "${1}" echo "Reformatting file: ${1}" - else - echo "Already formatted: ${1}" fi; ;; *) diff --git a/tests/CreationTest.cpp b/tests/CreationTest.cpp index 0603837e..2d6e55fb 100644 --- a/tests/CreationTest.cpp +++ b/tests/CreationTest.cpp @@ -331,13 +331,15 @@ TEST_F(TApp, OptionFromDefaultsSubcommands) { EXPECT_EQ(app2->option_defaults()->get_group(), "Something"); } -TEST_F(TApp, HelpFlagFromDefaultsSubcommands) { - app.set_help_flag("--that", "Wow"); +TEST_F(TApp, GetNameCheck) { + int x; + auto a = app.add_flag("--that"); + auto b = app.add_flag("-x"); + auto c = app.add_option("pos", x); - auto app2 = app.add_subcommand("app2"); - - EXPECT_EQ(app2->get_help_ptr()->get_name(), "--that"); - EXPECT_EQ(app2->get_help_ptr()->get_description(), "Wow"); + EXPECT_EQ(a->get_name(), "--that"); + EXPECT_EQ(b->get_name(), "-x"); + EXPECT_EQ(c->get_name(), "pos"); } TEST_F(TApp, SubcommandDefaults) {