(m *testing.M)
| 22 | ) |
| 23 | |
| 24 | func 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 | |
| 52 | type testRecipient struct{} |
| 53 |
nothing calls this directly
no test coverage detected
searching dependent graphs…