Simplified test cases configs
This commit is contained in:
@@ -15,10 +15,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#define CATCH_CONFIG_RUNNER
|
||||
#define CATCH_CONFIG_CONSOLE_WIDTH 512
|
||||
|
||||
#include "catch.h"
|
||||
|
||||
#include "cli/cli_handler.h"
|
||||
#include "common/compilation_database.h"
|
||||
|
||||
#include "util/util.h"
|
||||
|
||||
#include "catch.h"
|
||||
@@ -41,6 +44,7 @@ TEST_CASE("Test compilation_database should work", "[unit-test]")
|
||||
using clanguml::util::contains;
|
||||
using std::filesystem::path;
|
||||
|
||||
// This is executed by cmake in the directory `<BUILD_DIRECTORY>/tests`
|
||||
auto cfg =
|
||||
clanguml::config::load("./test_compilation_database_data/config.yml");
|
||||
|
||||
@@ -91,4 +95,37 @@ TEST_CASE("Test compilation_database should throw", "[unit-test]")
|
||||
REQUIRE_THROWS_AS(
|
||||
clanguml::common::compilation_database::auto_detect_from_directory(cfg),
|
||||
compilation_database_error);
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Main test function
|
||||
///
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Catch::Session session;
|
||||
using namespace Catch::clara;
|
||||
|
||||
bool debug_log{false};
|
||||
auto cli = session.cli() |
|
||||
Opt(debug_log, "debug_log")["-u"]["--debug-log"]("Enable debug logs");
|
||||
|
||||
session.cli(cli);
|
||||
|
||||
int returnCode = session.applyCommandLine(argc, argv);
|
||||
if (returnCode != 0)
|
||||
return returnCode;
|
||||
|
||||
clanguml::cli::cli_handler clih;
|
||||
|
||||
std::vector<const char *> argvv = {
|
||||
"clang-uml", "--config", "./test_config_data/simple.yml"};
|
||||
|
||||
if (debug_log)
|
||||
argvv.push_back("-vvv");
|
||||
else
|
||||
argvv.push_back("-q");
|
||||
|
||||
clih.handle_options(argvv.size(), argvv.data());
|
||||
|
||||
return session.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user