|
|
|
@ -7,6 +7,8 @@ package("gtest") |
|
|
|
|
add_urls("https://github.com/google/googletest.git", {alias = "github"}) |
|
|
|
|
add_versions("github:1.8.1", "release-1.8.1") |
|
|
|
|
add_versions("archive:1.8.1", "927827c183d01734cc5cfef85e0ff3f5a92ffe6188e0d18e909c5efebf28a0c7") |
|
|
|
|
add_versions("github:1.10.0", "release-1.10.0") |
|
|
|
|
add_versions("archive:1.10.0", "94c634d499558a76fa649edb13721dce6e98fb1e7018dfaeba3cd7a083945e91") |
|
|
|
|
|
|
|
|
|
if is_plat("linux") then |
|
|
|
|
add_syslinks("pthread") |
|
|
|
@ -16,9 +18,17 @@ package("gtest") |
|
|
|
|
io.writefile("xmake.lua", [[ |
|
|
|
|
target("gtest") |
|
|
|
|
set_kind("static") |
|
|
|
|
set_languages("cxx11") |
|
|
|
|
add_files("googletest/src/gtest-all.cc") |
|
|
|
|
add_includedirs("googletest/include", "googletest") |
|
|
|
|
add_headerfiles("googletest/include/(**.h)") |
|
|
|
|
|
|
|
|
|
target("gmock") |
|
|
|
|
set_kind("static") |
|
|
|
|
set_languages("cxx11") |
|
|
|
|
add_files("googlemock/src/gmock-all.cc") |
|
|
|
|
add_includedirs("googlemock/include", "googlemock", "googletest/include", "googletest") |
|
|
|
|
add_headerfiles("googlemock/include/(**.h)") |
|
|
|
|
]]) |
|
|
|
|
import("package.tools.xmake").install(package) |
|
|
|
|
end) |
|
|
|
@ -34,4 +44,35 @@ package("gtest") |
|
|
|
|
EXPECT_EQ(3628800, factorial(10)); |
|
|
|
|
} |
|
|
|
|
]]}, {configs = {languages = "c++11"}, includes = "gtest/gtest.h"})) |
|
|
|
|
|
|
|
|
|
assert(package:check_cxxsnippets({test = [[ |
|
|
|
|
using ::testing::AtLeast; |
|
|
|
|
|
|
|
|
|
class A { |
|
|
|
|
public: |
|
|
|
|
virtual void a_foo() { return; } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class mock_A : public A { |
|
|
|
|
public: |
|
|
|
|
MOCK_METHOD0(a_foo, void()); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class B { |
|
|
|
|
public: |
|
|
|
|
A* target; |
|
|
|
|
B(A* param) : target(param) {} |
|
|
|
|
|
|
|
|
|
bool b_foo() { target->a_foo(); return true; } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
TEST(test_code, step1) { |
|
|
|
|
mock_A a_obj; |
|
|
|
|
B b_obj(&a_obj); |
|
|
|
|
|
|
|
|
|
EXPECT_CALL(a_obj, a_foo()).Times(AtLeast(1)); |
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(b_obj.b_foo()); |
|
|
|
|
} |
|
|
|
|
]]}, {configs = {languages = "c++11"}, includes = {"gtest/gtest.h", "gmock/gmock.h"}})) |
|
|
|
|
end) |
|
|
|
|