Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cucumber_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@


add_subdirectory(library)
add_subdirectory(runner)
add_subdirectory(example)
add_subdirectory(acceptance_test)

add_library(cucumber_cpp INTERFACE)

target_sources(cucumber_cpp INTERFACE
CucumberCpp.hpp
)

target_include_directories(cucumber_cpp INTERFACE
./
)

target_link_libraries(cucumber_cpp INTERFACE
cucumber_cpp.library
)
18 changes: 18 additions & 0 deletions cucumber_cpp/CucumberCpp.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef CUCUMBER_CPP_CUCUMBER_CPP_HPP
#define CUCUMBER_CPP_CUCUMBER_CPP_HPP

#include "cucumber_cpp/library/Application.hpp"
#include "cucumber_cpp/library/Context.hpp"
#include "cucumber_cpp/library/Hooks.hpp"
#include "cucumber_cpp/library/Steps.hpp"
#include "cucumber_cpp/library/report/Report.hpp"

namespace cucumber_cpp
{
using cucumber_cpp::library::Application;
using cucumber_cpp::library::Context;
using cucumber_cpp::library::engine::Step;
using cucumber_cpp::library::report::ReportHandlerV2;
}

#endif
8 changes: 3 additions & 5 deletions cucumber_cpp/acceptance_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ set(CMAKE_COMPILE_WARNING_AS_ERROR On)

add_executable(cucumber_cpp.acceptance_test ${CCR_EXCLUDE_FROM_ALL})

target_sources(cucumber_cpp.acceptance_test PRIVATE
Main.cpp
)
target_link_libraries(cucumber_cpp.acceptance_test PRIVATE
cucumber_cpp.library
cucumber_cpp
cucumber_cpp.runner
cucumber_cpp.acceptance_test.hooks
cucumber_cpp.acceptance_test.steps
)
Expand All @@ -18,7 +16,7 @@ target_sources(cucumber_cpp.acceptance_test.custom PRIVATE
)

target_link_libraries(cucumber_cpp.acceptance_test.custom PRIVATE
cucumber_cpp.library
cucumber_cpp
cucumber_cpp.acceptance_test.hooks
cucumber_cpp.acceptance_test.steps
)
Expand Down
9 changes: 0 additions & 9 deletions cucumber_cpp/acceptance_test/Main.cpp

This file was deleted.

5 changes: 2 additions & 3 deletions cucumber_cpp/acceptance_test/MainCustom.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#include "cucumber_cpp/library/Application.hpp"
#include <span>
#include "cucumber_cpp/CucumberCpp.hpp"

int main(int argc, char** argv)
{
cucumber_cpp::library::Application application{};
cucumber_cpp::Application application{};

application.CliParser().add_flag("--required", *application.ProgramContext().EmplaceAt<bool>("--required"))->required();

Expand Down
4 changes: 4 additions & 0 deletions cucumber_cpp/acceptance_test/features/test_hooks.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
@bats
Feature: Test scenario and step hook bindings

@program_hooks
Scenario: Run failing Scenario hooks before
Given a given step

@fail_scenariohook_before
Scenario: Run failing Scenario hooks before
Given a given step
Expand Down
2 changes: 1 addition & 1 deletion cucumber_cpp/acceptance_test/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ teardown() {
}

@test "Run Program hooks" {
run .build/Host/cucumber_cpp/acceptance_test/Debug/cucumber_cpp.acceptance_test run --feature cucumber_cpp/acceptance_test/features --tag @bats --report console
run .build/Host/cucumber_cpp/acceptance_test/Debug/cucumber_cpp.acceptance_test run --feature cucumber_cpp/acceptance_test/features --tag @bats and @program_hooks --report console
assert_success

assert_output --partial "HOOK_BEFORE_ALL"
Expand Down
2 changes: 1 addition & 1 deletion cucumber_cpp/example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ target_sources(cucumber_cpp.example PRIVATE
)

target_link_libraries(cucumber_cpp.example PRIVATE
cucumber_cpp.library
cucumber_cpp
cucumber_cpp.example.hooks
cucumber_cpp.example.steps
)
Expand Down
4 changes: 2 additions & 2 deletions cucumber_cpp/example/Main.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "cucumber_cpp/library/Application.hpp"
#include "cucumber_cpp/CucumberCpp.hpp"
#include <string>

int main(int argc, char** argv)
{
cucumber_cpp::library::Application application{};
cucumber_cpp::Application application{};

application.CliParser().add_option("--com", *application.ProgramContext().EmplaceAt<std::string>("--com"))->required();
auto* stOpt = application.CliParser().add_flag("--st", *application.ProgramContext().EmplaceAt<bool>("--st"));
Expand Down
4 changes: 2 additions & 2 deletions cucumber_cpp/example/hooks/Hooks.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "cucumber_cpp/library/Hooks.hpp"
#include "cucumber_cpp/example/fixtures/Fixture.hpp"
#include "cucumber_cpp/library/Context.hpp"
#include <algorithm>
#include <string_view>
#include <iostream>
#include <string>

HOOK_BEFORE_ALL()
{
Expand Down
1 change: 0 additions & 1 deletion cucumber_cpp/example/steps/Steps.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "cucumber_cpp/library/Steps.hpp"
#include "cucumber_cpp/library/Context.hpp"
#include "cucumber_cpp/library/engine/FailureHandler.hpp"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <cstdint>
Expand Down
2 changes: 1 addition & 1 deletion cucumber_cpp/runner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ target_sources(cucumber_cpp.runner PRIVATE
)

target_link_libraries(cucumber_cpp.runner PUBLIC
cucumber_cpp.library
cucumber_cpp
)
5 changes: 2 additions & 3 deletions cucumber_cpp/runner/Main.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#include "cucumber_cpp/library/Application.hpp"
#include <span>
#include "cucumber_cpp/CucumberCpp.hpp"

int main(int argc, char** argv)
{
cucumber_cpp::library::Application application{};
cucumber_cpp::Application application{};

return application.Run(argc, argv);
}
3 changes: 1 addition & 2 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ sonar.c.file.suffixes=.c,.h
sonar.cpp.file.suffixes=.cc,.cpp,.cxx,.c++,.hh,.hpp,.hxx,.h++,.ipp

sonar.sources=cucumber_cpp
# sonar.exclusions=cucumber_cpp/acceptance_test/**/*,cucumber_cpp/example/**/*

sonar.tests=cucumber_cpp
sonar.test.inclusions=**/test/*,**/test_doubles/*,**/test_helper/*
Expand All @@ -26,7 +25,7 @@ sonar.cfamily.threads=2

sonar.testExecutionReportPaths=execution.xml
sonar.coverageReportPaths=coverage.xml
sonar.coverage.exclusions=cucumber_cpp/acceptance_test/**/*,cucumber_cpp/example/**/*
sonar.coverage.exclusions=cucumber_cpp/acceptance_test/**/*,cucumber_cpp/example/**/*,cucumber_cpp/runner/Main.cpp
sonar.cpd.exclusions=${env.SONAR_DUPLICATION_EXCLUSIONS}

# Project specific ignored rules
Expand Down
Loading