Switch from Asuka to MyGo, keeping the API client and the feature set: - servers: saved servers, passwordless and password login, proxy, self-signed certificates, per-server device tokens (Keystore), connect form, instance list sheet with switch/disconnect - sessions: virtualized list, search, new session, rename/archive/delete, running indicator, event stream keeps it live - chat: pushed window with system back bar, streaming Markdown via ui/markdown, reasoning and tool rows with image previews, footer menu (read aloud via a Kotlin TTS plugin, copy, fork), user message menu (copy, revert, fork), context usage ring and detail sheet, attachments (photos/files via the document picker), permissions - release builds allow plain http:// LAN servers (Go's net/http dials directly, no cleartext manifest needed) - a local fork of MyGo (third_party/mygo) lowers the Android host's minSdk to 24 (Android 7.0); Go 1.27.4 via mise Version 0.3.0.
57 lines
1.8 KiB
Go
57 lines
1.8 KiB
Go
//go:build darwin && !ios
|
|
|
|
package darwin
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
)
|
|
|
|
func TestHourCycle(t *testing.T) {
|
|
for pattern, want := range map[string]int{"h a": 12, "HH": 24, "K a": 12, "k": 24, "'h'": 0, "a 'o''clock' h": 12, "": 0} {
|
|
if got := hourCycle(pattern); got != want {
|
|
t.Errorf("hourCycle(%q) = %d, want %d", pattern, got, want)
|
|
}
|
|
}
|
|
}
|
|
|
|
// The current locale's change is observed under the name Foundation posts
|
|
// it under: observed by the constant's name, it never comes, and the region
|
|
// is read only at the time format's notification, before the current
|
|
// locale has the new format, one change behind.
|
|
func TestCurrentLocaleDidChangeName(t *testing.T) {
|
|
load()
|
|
if got := goString(currentLocaleDidChange()); got != "kCFLocaleCurrentLocaleDidChangeNotification" {
|
|
t.Errorf("NSCurrentLocaleDidChangeNotification is posted as %q", got)
|
|
}
|
|
}
|
|
|
|
// TestLocales reads the user's languages and formats, and keeps the app's
|
|
// language in its own defaults, where the global languages do not see it.
|
|
func TestLocales(t *testing.T) {
|
|
load()
|
|
a := appController{}
|
|
langs := a.PreferredLanguages()
|
|
if len(langs) == 0 {
|
|
t.Fatal("no preferred languages")
|
|
}
|
|
if r := a.Region(); r.Locale == "" || r.FirstWeekday < 0 || r.HourCycle == 0 {
|
|
t.Errorf("Region() = %+v", r)
|
|
}
|
|
if tag, kept := a.SavedLocale(); !kept || tag != "" {
|
|
t.Fatalf("SavedLocale() = %q, %v before saving", tag, kept)
|
|
}
|
|
t.Cleanup(func() { a.SaveLocale("") })
|
|
a.SaveLocale("x-test")
|
|
if tag, _ := a.SavedLocale(); tag != "x-test" {
|
|
t.Errorf("SavedLocale() = %q after saving x-test", tag)
|
|
}
|
|
if got := a.PreferredLanguages(); !slices.Equal(got, langs) {
|
|
t.Errorf("the app's language changed the user's: %q, were %q", got, langs)
|
|
}
|
|
a.SaveLocale("")
|
|
if tag, _ := a.SavedLocale(); tag != "" {
|
|
t.Errorf("SavedLocale() = %q after forgetting it", tag)
|
|
}
|
|
}
|