Standard fenrir backgrounding and -d flags restored.
This commit is contained in:
1 parent
4f5a875d0e
commit
eaf450587c
13 files changed
+408
-20
No files matched your search
@@ -772,3 +772,45 @@ func TestScreenWatcherFailureReleasesKeyboards(t *testing.T) {
|
||||
t.Fatal("screen watcher failure left keyboards open")
|
||||
}
|
||||
}
|
||||
|
||||
func TestStartupReadinessFollowsInitialScreenAndInput(t *testing.T) {
|
||||
for _, failure := range []string{"", "screen", "input", "notification"} {
|
||||
t.Run(failure, func(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
problem := errors.New("startup fixture failure")
|
||||
source := &fakeSource{snapshot: screen.Snapshot{Terminal: 1}}
|
||||
keys := &fakeKeys{}
|
||||
read, polled, ready := false, false, false
|
||||
source.afterRead = func() { read = true }
|
||||
if failure == "screen" {
|
||||
source.readErr = problem
|
||||
}
|
||||
keys.poll = func(bool, func(input.Decision)) error {
|
||||
polled = true
|
||||
if failure == "input" {
|
||||
return problem
|
||||
}
|
||||
return nil
|
||||
}
|
||||
opts := RunOptions{Settings: config.Defaults(), Ready: func() error {
|
||||
if !read || !polled {
|
||||
t.Fatal("readiness preceded initial screen or input")
|
||||
}
|
||||
ready = true
|
||||
cancel()
|
||||
if failure == "notification" {
|
||||
return problem
|
||||
}
|
||||
return nil
|
||||
}}
|
||||
err := run(ctx, source, keys, &fakeVoice{}, nil, opts)
|
||||
if failure != "" && !errors.Is(err, problem) || failure == "" && err != nil {
|
||||
t.Fatal("unexpected startup result", err)
|
||||
}
|
||||
if ready != (failure == "" || failure == "notification") || !keys.closed {
|
||||
t.Fatal("startup failure reported readiness or left input open", ready, keys.closed)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user