summaryrefslogtreecommitdiff
path: root/callback_test.go
blob: 45a84be75a2ded964789e696a8ad87d4561996ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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")
	}
	cbDelete(c)
}

func TestCallback_002(t *testing.T) {
	defer func() {
		recover()
	}()
	c := cbAdd(TestCallback_002)
	cbGet(c + 1)
	t.Error("Expected a panic")
}

func TestCallback_003(t *testing.T) {
	defer func() {
		recover()
	}()
	c := cbAdd(TestCallback_003)
	cbDelete(c + 1)
	t.Error("Expected a panic")
}