diff options
author | Marco Trevisan (Treviño) <[email protected]> | 2023-09-19 20:04:06 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <[email protected]> | 2023-09-19 20:06:38 +0200 |
commit | 78ffef4acdc2b5b6365c7167405cf72239da584a (patch) | |
tree | b5af24a72244faeccbda6a86ea754293214560fe /callback_test.go | |
parent | 5253f659f39e53933241047250d12d92aa173192 (diff) |
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
Diffstat (limited to 'callback_test.go')
-rw-r--r-- | callback_test.go | 33 |
1 files changed, 0 insertions, 33 deletions
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") -} |