Debian Codegraph @

internal/efw/result_test.go

raw symbols SCIP
1 //go:build windows
2
3 package efw
4
5 import (
6 "testing"
7
8 "github.com/go-quicktest/qt"
9 )
10
11 func TestResultToError(t *testing.T) {
12 qt.Assert(t, qt.IsNil(resultToError(EBPF_SUCCESS)))
13 qt.Assert(t, qt.IsNotNil(resultToError(EBPF_ACCESS_DENIED)))
14
15 // Ensure that common results do not allocate.
16 for _, result := range []Result{
17 EBPF_SUCCESS,
18 EBPF_NO_MORE_KEYS,
19 EBPF_KEY_NOT_FOUND,
20 } {
21 t.Run(result.String(), func(t *testing.T) {
22 allocs := testing.AllocsPerRun(1, func() {
23 _ = resultToError(result)
24 })
25 qt.Assert(t, qt.Equals(allocs, 0.0))
26 })
27 }
28 }