Stop passing Go pointers to C

This commit is contained in:
Michael Steinert
2015-12-03 14:59:51 -06:00
parent 6534f23b39
commit 8ec1202046
5 changed files with 77 additions and 30 deletions

23
callback_test.go Normal file
View File

@@ -0,0 +1,23 @@
package pam
import (
"reflect"
"testing"
)
func TestCallback_001(t *testing.T) {
c := cbAdd(TestCallback_001)
v := cbGet(c)
if reflect.TypeOf(v) != reflect.TypeOf(TestCallback_001) {
t.Error("Received unexpected value")
}
}
func TestCallback_002(t *testing.T) {
defer func() {
recover()
}()
c := cbAdd(TestCallback_002)
cbGet(c + 1)
t.Error("Expected a panic")
}