File: callback_test.go

package info (click to toggle)
golang-github-msteinert-pam 0.0~git20170830.0.f4cd9f5-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 108 kB
  • sloc: ansic: 44; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 544 bytes parent folder | download | duplicates (3)
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")
}