(t *testing.T)
| 68 | } |
| 69 | |
| 70 | func TestLabels(t *testing.T) { |
| 71 | if runtime.GOOS == "windows" { |
| 72 | t.Skip("Windows support is TODO") |
| 73 | } |
| 74 | temp := t.TempDir() |
| 75 | testOnlyPluginPath = temp |
| 76 | t.Cleanup(func() { testOnlyPluginPath = "" }) |
| 77 | ex, err := os.Executable() |
| 78 | if err != nil { |
| 79 | t.Fatal(err) |
| 80 | } |
| 81 | if err := os.Link(ex, filepath.Join(temp, "age-plugin-test")); err != nil { |
| 82 | t.Fatal(err) |
| 83 | } |
| 84 | if err := os.Chmod(filepath.Join(temp, "age-plugin-test"), 0755); err != nil { |
| 85 | t.Fatal(err) |
| 86 | } |
| 87 | if err := os.Link(ex, filepath.Join(temp, "age-plugin-testpqc")); err != nil { |
| 88 | t.Fatal(err) |
| 89 | } |
| 90 | if err := os.Chmod(filepath.Join(temp, "age-plugin-testpqc"), 0755); err != nil { |
| 91 | t.Fatal(err) |
| 92 | } |
| 93 | |
| 94 | name, err := bech32.Encode("age1test", nil) |
| 95 | if err != nil { |
| 96 | t.Fatal(err) |
| 97 | } |
| 98 | testPlugin, err := NewRecipient(name, &ClientUI{}) |
| 99 | if err != nil { |
| 100 | t.Fatal(err) |
| 101 | } |
| 102 | namePQC, err := bech32.Encode("age1testpqc", nil) |
| 103 | if err != nil { |
| 104 | t.Fatal(err) |
| 105 | } |
| 106 | testPluginPQC, err := NewRecipient(namePQC, &ClientUI{}) |
| 107 | if err != nil { |
| 108 | t.Fatal(err) |
| 109 | } |
| 110 | |
| 111 | if _, err := age.Encrypt(io.Discard, testPluginPQC); err != nil { |
| 112 | t.Errorf("expected one pqc to work, got %v", err) |
| 113 | } |
| 114 | if _, err := age.Encrypt(io.Discard, testPluginPQC, testPluginPQC); err != nil { |
| 115 | t.Errorf("expected two pqc to work, got %v", err) |
| 116 | } |
| 117 | if _, err := age.Encrypt(io.Discard, testPluginPQC, testPlugin); err == nil { |
| 118 | t.Errorf("expected one pqc and one normal to fail") |
| 119 | } |
| 120 | if _, err := age.Encrypt(io.Discard, testPlugin, testPluginPQC); err == nil { |
| 121 | t.Errorf("expected one pqc and one normal to fail") |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | func TestNotFound(t *testing.T) { |
| 126 | if runtime.GOOS == "windows" { |
nothing calls this directly
no test coverage detected
searching dependent graphs…