Skip to content

Commit 2627864

Browse files
authored
Merge pull request #78 from build-cpp/fix-tests
Successfully fail when running cmkr subcommands
2 parents 8b19441 + 05e21f7 commit 2627864

File tree

6 files changed

+7
-19
lines changed

6 files changed

+7
-19
lines changed

docs/examples/vcpkg.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ description = "Dependencies from vcpkg"
1919
# See https://github.com/microsoft/vcpkg/releases for vcpkg versions
2020
# See https://vcpkg.io/en/packages.html for available packages
2121
[vcpkg]
22-
version = "2021.05.12"
22+
version = "2022.11.14"
2323
packages = ["fmt"]
2424

2525
[find-package]

include/arguments.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,3 @@ const char *handle_args(int argc, char **argv);
77

88
} // namespace args
99
} // namespace cmkr
10-
11-
const char *cmkr_args_handle_args(int, char **);

src/arguments.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,21 @@ const char *handle_args(int argc, char **argv) {
3737
} else if (main_arg == "build") {
3838
auto ret = build::run(argc, argv);
3939
if (ret)
40-
return "CMake build error!";
40+
throw std::runtime_error("CMake build failed!");
4141
return "CMake build completed!";
4242
} else if (main_arg == "install") {
4343
auto ret = build::install();
4444
if (ret)
45-
return "CMake install error!";
45+
throw std::runtime_error("CMake install failed!");
4646
return "CMake install completed!";
4747
} else if (main_arg == "clean") {
4848
auto ret = build::clean();
4949
if (ret)
50-
return "CMake clean error!";
50+
throw std::runtime_error("CMake clean failed!");
5151
return "Cleaned build directory!";
5252
} else {
5353
throw std::runtime_error(cmkr::help::message());
5454
}
5555
}
5656
} // namespace args
5757
} // namespace cmkr
58-
59-
const char *cmkr_args_handle_args(int argc, char **argv) {
60-
try {
61-
return cmkr::args::handle_args(argc, argv);
62-
} catch (const std::exception &e) {
63-
return e.what();
64-
} catch (...) {
65-
return "Unknown error!";
66-
}
67-
}
File renamed without changes.

tests/interface/src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
int main()
66
{
7-
printf("mylib version: %s\n", mylib::version())
8-
}
7+
printf("mylib version: %s\n", mylib::version());
8+
}

tests/vcpkg/cmake.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description = "Dependencies from vcpkg"
77
# See https://github.com/microsoft/vcpkg/releases for vcpkg versions
88
# See https://vcpkg.io/en/packages.html for available packages
99
[vcpkg]
10-
version = "2021.05.12"
10+
version = "2022.11.14"
1111
packages = ["fmt"]
1212

1313
[find-package]

0 commit comments

Comments
 (0)