summaryrefslogtreecommitdiff
path: root/android_shared_stub_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-09 08:42:36 +0300
committerPaul Buetow <paul@buetow.org>2026-04-09 08:42:36 +0300
commitc4e0c74f0608626ecf55a3afe0e74ef25dacb0b3 (patch)
tree64c2e53d13262147c4edb461432f6430c1293984 /android_shared_stub_test.go
parent7c08fe44282c076e2470fe19a1eacff209cfa4f2 (diff)
Add shared-text test coverage
Diffstat (limited to 'android_shared_stub_test.go')
-rw-r--r--android_shared_stub_test.go36
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)
+ }
+}