Tests for Method Go bindings.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/7073bd06 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/7073bd06 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/7073bd06 Branch: refs/heads/master Commit: 7073bd06c9ce58f83a910d78d9f665e268902069 Parents: a3ce8dd Author: Marvin Humphrey <[email protected]> Authored: Fri Aug 7 17:54:26 2015 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Sun Aug 9 19:00:35 2015 -0700 ---------------------------------------------------------------------- runtime/go/clownfish/method_test.go | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/7073bd06/runtime/go/clownfish/method_test.go ---------------------------------------------------------------------- diff --git a/runtime/go/clownfish/method_test.go b/runtime/go/clownfish/method_test.go new file mode 100644 index 0000000..3e3d1f6 --- /dev/null +++ b/runtime/go/clownfish/method_test.go @@ -0,0 +1,51 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package clownfish + +import "testing" +import "unsafe" + +func TestMethodGetName(t *testing.T) { + meth := NewMethod("Do_Stuff", unsafe.Pointer(nil), 32) + if name := meth.GetName(); name != "Do_Stuff" { + t.Errorf("Expected \"Do_Stuff\", got %s", name) + } +} + +func TestMethodGetHostAlias(t *testing.T) { + meth := NewMethod("Do_Stuff", unsafe.Pointer(nil), 32) + alias := "GetStuffDone" + meth.SetHostAlias(alias) + if got := meth.GetHostAlias(); got != alias { + t.Errorf("Expected %v, got %v", alias, got) + } +} + +func TestMethodHostName(t *testing.T) { + meth := NewMethod("Do_Stuff", unsafe.Pointer(nil), 32) + expected := "DoStuff" + if hostName := meth.HostName(); hostName != expected { + t.Errorf("Expected %v, got %v", expected, hostName) + } +} + +func TestMethodIsExcludedFromHost(t *testing.T) { + meth := NewMethod("Do_Stuff", unsafe.Pointer(nil), 32) + if meth.IsExcludedFromHost() { + t.Errorf("Meth should not be excluded") + } +}
