MCPcopy
hub / github.com/FiloSottile/age / TestMain

Function TestMain

plugin/client_test.go:24–50  ·  view source on GitHub ↗
(m *testing.M)

Source from the content-addressed store, hash-verified

22)
23
24func TestMain(m *testing.M) {
25 switch filepath.Base(os.Args[0]) {
26 case "age-plugin-test":
27 p, _ := New("test")
28 p.HandleRecipient(func(data []byte) (age.Recipient, error) {
29 return testRecipient{}, nil
30 })
31 os.Exit(p.Main())
32 case "age-plugin-testpqc":
33 p, _ := New("testpqc")
34 p.HandleRecipient(func(data []byte) (age.Recipient, error) {
35 return testPQCRecipient{}, nil
36 })
37 os.Exit(p.Main())
38 case "age-plugin-error":
39 p, _ := New("error")
40 p.HandleRecipient(func(data []byte) (age.Recipient, error) {
41 return nil, errors.New("oh my, an error occurred")
42 })
43 p.HandleIdentity(func(data []byte) (age.Identity, error) {
44 return nil, errors.New("oh my, an error occurred")
45 })
46 os.Exit(p.Main())
47 default:
48 os.Exit(m.Run())
49 }
50}
51
52type testRecipient struct{}
53

Callers

nothing calls this directly

Calls 4

NewFunction · 0.85
HandleRecipientMethod · 0.80
MainMethod · 0.80
HandleIdentityMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…