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.
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package tsgen
|
|
|
|
import (
|
|
"reflect"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestServiceExportNames(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
name string
|
|
events, valid bool
|
|
}{
|
|
{"await", false, false}, {"default", false, false}, {"class", false, false},
|
|
{"call", false, false}, {"event", true, false}, {"events", true, false},
|
|
{"event", false, true}, {"events", false, true}, {"Tasks", true, true},
|
|
} {
|
|
name := tc.name
|
|
if tc.events {
|
|
name += "WithEvents"
|
|
}
|
|
t.Run(name, func(t *testing.T) {
|
|
m := Model{Services: []Service{{Name: tc.name, Type: reflect.TypeFor[struct{}](), Methods: []Method{{Name: "Run"}}}}}
|
|
if tc.events {
|
|
m.Events = []Event{{Name: "changed", Type: reflect.TypeFor[string]()}}
|
|
}
|
|
out, err := Generate(m)
|
|
if tc.valid {
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !strings.Contains(string(out), `export const `+tc.name+` =`) || !strings.Contains(string(out), `"`+tc.name+`.Run"`) {
|
|
t.Fatalf("lost service name: %s", out)
|
|
}
|
|
} else if err == nil || !strings.Contains(err.Error(), tc.name) {
|
|
t.Fatalf("Generate must report service %q rather than write an invalid binding: %v\n%s", tc.name, err, out)
|
|
}
|
|
})
|
|
}
|
|
}
|