From 78ffef4acdc2b5b6365c7167405cf72239da584a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 19 Sep 2023 20:04:06 +0200 Subject: transaction: Use cgo.Handle to pass callback data to PAM Go provides a nicer way to handle Go structs lifetime when they are passed to C now, so use this instead of a custom implementation that requires to store them in a map --- callback_test.go | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 callback_test.go (limited to 'callback_test.go') diff --git a/callback_test.go b/callback_test.go deleted file mode 100644 index 45a84be..0000000 --- a/callback_test.go +++ /dev/null @@ -1,33 +0,0 @@ -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") -} -- cgit v1.2.3