add fakeit (#3848)
parent
3ed6be7668
commit
aa26b7fd4c
1 changed files with 54 additions and 0 deletions
@ -0,0 +1,54 @@ |
||||
package("fakeit") |
||||
set_kind("library", {headeronly = true}) |
||||
set_homepage("https://github.com/eranpeer/FakeIt") |
||||
set_description("C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.") |
||||
set_license("MIT") |
||||
|
||||
add_urls("https://github.com/eranpeer/FakeIt/archive/refs/tags/$(version).tar.gz", |
||||
"https://github.com/eranpeer/FakeIt.git") |
||||
|
||||
add_versions("2.4.0", "eb79459ad6a97a5c985e3301b0d44538bdce2ba26115afe040f3874688edefb5") |
||||
|
||||
local test_frameworks = { |
||||
"gtest", |
||||
"mstest", |
||||
"boost", |
||||
"catch", |
||||
"tpunit", |
||||
"mettle", |
||||
"qtest", |
||||
"nunit", |
||||
"cute", |
||||
"doctest", |
||||
"standalone", |
||||
} |
||||
|
||||
add_configs("framework", {description = "Choose test library to use", default = "standalone", type = "string", values = test_frameworks}) |
||||
|
||||
on_load(function (package) |
||||
local framework = package:config("framework") |
||||
if framework == "gtest" then |
||||
package:add("deps", "gtest") |
||||
elseif framework == "boost" then |
||||
package:add("deps", "boost", {configs = {test = true}}) |
||||
elseif framework == "catch" then |
||||
package:add("deps", "catch2") |
||||
elseif framework == "doctest" then |
||||
package:add("deps", "doctest") |
||||
end |
||||
end) |
||||
|
||||
on_install(function (package) |
||||
os.vcp(path.join("single_header", package:config("framework"), "*"), package:installdir("include")) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
struct SomeInterface { |
||||
virtual int foo(int) = 0; |
||||
}; |
||||
void test() { |
||||
fakeit::Mock<SomeInterface> mock; |
||||
} |
||||
]]}, {configs = {languages = "c++11"}, includes = "fakeit.hpp"})) |
||||
end) |
Loading…
Reference in new issue