Skip to content

Review of the ContextBase include file. #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from 6 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
29 changes: 26 additions & 3 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cc_library(
name = "include",
hdrs = [
"include/proxy-wasm/compat.h",
"include/proxy-wasm/context.h",
"include/proxy-wasm/wasm_vm.h",
"include/proxy-wasm/word.h",
],
Expand All @@ -19,6 +20,7 @@ cc_library(
name = "include14",
hdrs = [
"include/proxy-wasm/compat.h",
"include/proxy-wasm/context.h",
"include/proxy-wasm/wasm_vm.h",
"include/proxy-wasm/word.h",
],
Expand All @@ -33,9 +35,16 @@ cc_test(
srcs = ["wasm_vm_test.cc"],
deps = [
":include",
"@com_google_absl//absl/base",
"@com_google_absl//absl/strings:strings",
"@com_google_absl//absl/types:optional",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "context_test",
srcs = ["context_test.cc"],
deps = [
":include",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
],
Expand All @@ -55,3 +64,17 @@ cc_test(
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "context_14_test",
srcs = ["context_test.cc"],
copts = ["-std=c++14"],
deps = [
":include14",
"@com_google_absl//absl/base",
"@com_google_absl//absl/strings:strings",
"@com_google_absl//absl/types:optional",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
],
)
3 changes: 3 additions & 0 deletions VERSIONING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ABI Versioning

TODO
20 changes: 20 additions & 0 deletions context_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "include/proxy-wasm/context.h"

#include "gtest/gtest.h"

namespace proxy_wasm {
namespace {

class Context : public ContextBase {
public:
Context(std::function<void(string_view s)> error_function) : error_function_(error_function) {}
void error(string_view message) { error_function_(message); }

private:
std::function<void(string_view s)> error_function_;
};

TEST(Context, IncludeParses) {}

} // namespace
} // namespace proxy_wasm
12 changes: 4 additions & 8 deletions include/proxy-wasm/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@
// Provide compatibiliby for projects which have not yet moved to C++17.
// TODO: remove this when all dependent projects have upgraded.

#ifndef __cpp_lib_optional
#include "absl/types/optional.h"
#else
#if __cplusplus >= 201703L
#include <optional>
#endif

#ifndef __cpp_lib_string_view
#include "absl/strings/string_view.h"
#else
#include <string_view>
#else
#include "absl/types/optional.h"
#include "absl/strings/string_view.h"
#endif

namespace proxy_wasm {
Expand Down
Loading