Skip to content

Commit

Permalink
Merge pull request envoyproxy#5 from chowchow316/add-test
Browse files Browse the repository at this point in the history
Add unit test.
  • Loading branch information
qiwzhang authored Jan 12, 2017
2 parents 025cb87 + 5d9142d commit f585f33
Show file tree
Hide file tree
Showing 6 changed files with 382 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mixerclient/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ install:

script:
- script/check-style
- bazel build :all
- bazel test :all --test_output=errors
13 changes: 12 additions & 1 deletion mixerclient/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,15 @@ cc_library(
"//external:boringssl_crypto",
"//external:mixer_api_cc_proto",
],
)
)

cc_test(
name = "mixer_client_impl_test",
size = "small",
srcs = ["src/client_impl_test.cc"],
linkopts = ["-lm"],
deps = [
":mixer_client_lib",
"//external:googletest_main",
],
)
29 changes: 29 additions & 0 deletions mixerclient/BUILD.googletest
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

cc_library(
name = "googletest",
srcs = [
"googletest/src/gtest-all.cc",
"googlemock/src/gmock-all.cc",
],
hdrs = glob([
"googletest/include/**/*.h",
"googlemock/include/**/*.h",
"googletest/src/*.cc",
"googletest/src/*.h",
"googlemock/src/*.cc",
]),
includes = [
"googlemock",
"googletest",
"googletest/include",
"googlemock/include",
],
visibility = ["//visibility:public"],
)

cc_library(
name = "googletest_main",
srcs = ["googlemock/src/gmock_main.cc"],
visibility = ["//visibility:public"],
deps = [":googletest"],
)
19 changes: 18 additions & 1 deletion mixerclient/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,21 @@ new_git_repository(
bind(
name = "mixer_api_cc_proto",
actual = "@mixerapi_git//:mixer_api_cc_proto",
)
)

new_git_repository(
name = "googletest_git",
commit = "ec44c6c1675c25b9827aacd08c02433cccde7780",
remote = "https://github.com/google/googletest.git",
build_file = "BUILD.googletest",
)

bind(
name = "googletest",
actual = "@googletest_git//:googletest",
)

bind(
name = "googletest_main",
actual = "@googletest_git//:googletest_main",
)
2 changes: 1 addition & 1 deletion mixerclient/src/client_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MixerClientImpl : public MixerClient {
DoneFunc on_quota_done);

private:
const MixerClientOptions &options_;
MixerClientOptions options_;

GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MixerClientImpl);
};
Expand Down
Loading

0 comments on commit f585f33

Please sign in to comment.