Updated some documentation.

This commit is contained in:
Storm Dragon committed 2026-10-28 00:45:23 -04:00
1 parent 0e50de4c76
commit 4f5a875d0e
17 files changed
+2416 -6207

No files matched your search

+46
View File
@@ -7,6 +7,7 @@ import (
"context"
"os"
"reflect"
"strings"
"testing"
"git.stormux.org/storm/fenrir/internal/config"
@@ -15,6 +16,51 @@ import (
"git.stormux.org/storm/fenrir/internal/screen"
)
func TestLoginPromptStartupAndDelayedActivation(t *testing.T) {
for _, terminal := range []int{1, 2} {
// tty1 already has its boot login prompt. tty2's login program
// opens the console later, without a keyboard or screen event.
prompt := screen.Snapshot{Terminal: terminal, Active: true, Rows: 1, Cols: 7, Cells: []rune("login: ")}
source := &fakeSource{snapshot: prompt}
if terminal == 2 {
source.snapshot = screen.Snapshot{Terminal: terminal}
}
voice := &fakeVoice{}
var modes []bool
keys := &fakeKeys{poll: func(active bool, _ func(input.Decision)) error {
modes = append(modes, active)
return nil
}}
a, err := new_application(context.Background(), source, keys, voice, RunOptions{Settings: config.Defaults()})
if err != nil {
t.Fatal(err)
}
t.Cleanup(a.ui.close)
if err := a.read_screen(); err != nil {
t.Fatal(err)
}
if err := a.poll_input(true); err != nil {
t.Fatal(err)
}
if terminal == 2 {
if a.lastActive || len(voice.messages) != 0 {
t.Fatal("unused console was captured or read", a.lastActive, voice.messages)
}
source.snapshot = prompt
if err := a.poll_input(false); err != nil {
t.Fatal(err)
}
}
wantModes := []bool{true}
if terminal == 2 {
wantModes = []bool{false, true}
}
if !a.lastActive || !reflect.DeepEqual(modes, wantModes) || !strings.Contains(strings.Join(voice.messages, "|"), "login:") {
t.Fatal("login prompt did not resume input and speech", terminal, modes, voice.messages)
}
}
}
// Model the console's policy boundary independently of the shared application.
type policySource struct {
fakeSource