aboutsummaryrefslogtreecommitdiff
path: root/tests/core/go_plugin_with_proto_library/all_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/core/go_plugin_with_proto_library/all_test.go')
-rw-r--r--tests/core/go_plugin_with_proto_library/all_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/core/go_plugin_with_proto_library/all_test.go b/tests/core/go_plugin_with_proto_library/all_test.go
new file mode 100644
index 00000000..c09c6ef7
--- /dev/null
+++ b/tests/core/go_plugin_with_proto_library/all_test.go
@@ -0,0 +1,36 @@
+package main_test
+
+import (
+ "go_plugin_with_proto_library/validate"
+ "os"
+ "plugin"
+ "testing"
+)
+
+const RuleName = "test"
+
+func TestPluginCreated(t *testing.T) {
+ _, err := os.Stat("plugin.so")
+ if err != nil {
+ t.Error(err)
+ }
+}
+
+func TestPluginWorks(t *testing.T) {
+ p, err := plugin.Open("plugin.so")
+ if err != nil {
+ t.Error(err)
+ return
+ }
+
+ symProto, err := p.Lookup("SomeProto")
+ if err != nil {
+ t.Error(err)
+ return
+ }
+
+ proto := symProto.(*validate.MessageRules)
+ if *proto.Name != RuleName {
+ t.Errorf("expected %#v, got %#v", RuleName, proto.Name)
+ }
+}