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.
51 lines
1.4 KiB
Go
51 lines
1.4 KiB
Go
package uses_test
|
|
|
|
import (
|
|
"errors"
|
|
"slices"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/egoist/mygo/native/internal/roundtrip"
|
|
"github.com/egoist/mygo/native/internal/roundtrip/uses"
|
|
)
|
|
|
|
// mixer makes the module's implementation, skipping where it is not built:
|
|
// mygo native build -target host native/internal/roundtrip/uses.
|
|
func mixer(t *testing.T) uses.Mixer {
|
|
t.Helper()
|
|
m, err := uses.NewMixer()
|
|
if errors.Is(err, errors.ErrUnsupported) {
|
|
t.Skip("no implementation on this platform")
|
|
}
|
|
if err != nil && strings.Contains(err.Error(), "mygo native build") {
|
|
t.Skip(err)
|
|
}
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
return m
|
|
}
|
|
|
|
func TestOtherModule(t *testing.T) {
|
|
m := mixer(t)
|
|
p, err := m.Pair(uses.Pair{R: roundtrip.Record{Name: "r", Counts: []int{1, 2, 3}, Inner: roundtrip.Inner{X: 1, Y: 2}, Kind: roundtrip.KindC}})
|
|
if err != nil || p.N != 6 || p.R.Name != "r" || p.R.Kind != roundtrip.KindC || p.Inner == nil || *p.Inner != (roundtrip.Inner{X: 1, Y: 2}) {
|
|
t.Fatalf("Pair = %+v, %v", p, err)
|
|
}
|
|
if got := m.Kinds([]roundtrip.Record{{Kind: roundtrip.KindB}, {Kind: roundtrip.KindA}}); !slices.Equal(got, []roundtrip.Kind{roundtrip.KindB, roundtrip.KindA}) {
|
|
t.Fatalf("Kinds = %v", got)
|
|
}
|
|
e, err := roundtrip.NewEcho()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
c, err := e.Counter(7)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if a, b := m.Next(c), c.Next(); a != 7 || b != 8 {
|
|
t.Fatalf("Next = %d, then %d", a, b)
|
|
}
|
|
}
|