diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-09 08:42:36 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-09 08:42:36 +0300 |
| commit | c4e0c74f0608626ecf55a3afe0e74ef25dacb0b3 (patch) | |
| tree | 64c2e53d13262147c4edb461432f6430c1293984 /android_shared_stub_test.go | |
| parent | 7c08fe44282c076e2470fe19a1eacff209cfa4f2 (diff) | |
Add shared-text test coverage
Diffstat (limited to 'android_shared_stub_test.go')
| -rw-r--r-- | android_shared_stub_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/android_shared_stub_test.go b/android_shared_stub_test.go index cc62f5d..7b42b3a 100644 --- a/android_shared_stub_test.go +++ b/android_shared_stub_test.go @@ -13,3 +13,39 @@ func TestReadSharedFromCacheStub(t *testing.T) { t.Errorf("stub returned non-empty text: %q", txt) } } + +func TestHandleSharedTextLoadAutoLogSkipsEmptyStubText(t *testing.T) { + var clearCalls int + + handleSharedTextLoad( + "", + true, + t.TempDir(), + func(string) { + t.Fatal("prefill should not be called for empty shared text") + }, + func() { + t.Fatal("focus should not be called for empty shared text") + }, + func() { + t.Fatal("resetInput should not be called for empty shared text") + }, + func() { + clearCalls++ + }, + func(string, string) error { + t.Fatal("logEntry should not be called for empty shared text") + return nil + }, + func(string, string) { + t.Fatal("info dialog should not be shown for empty shared text") + }, + func(error) { + t.Fatal("error dialog should not be shown for empty shared text") + }, + ) + + if clearCalls != 1 { + t.Fatalf("expected cache cleanup once, got %d", clearCalls) + } +} |
