Files
msteinert-go-pam/callback_test.go

34 lines
544 B
Go
Raw Normal View History

2015-12-03 14:59:51 -06:00
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")
}
2015-12-04 09:03:39 -06:00
cbDelete(c)
2015-12-03 14:59:51 -06:00
}
func TestCallback_002(t *testing.T) {
defer func() {
recover()
}()
c := cbAdd(TestCallback_002)
cbGet(c + 1)
t.Error("Expected a panic")
}
2015-12-04 09:03:39 -06:00
func TestCallback_003(t *testing.T) {
defer func() {
recover()
}()
c := cbAdd(TestCallback_003)
cbDelete(c + 1)
t.Error("Expected a panic")
}