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.
60 lines
1.4 KiB
Go
60 lines
1.4 KiB
Go
package parser
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
type specExample struct {
|
|
Markdown string `json:"markdown"`
|
|
HTML string `json:"html"`
|
|
Example int `json:"example"`
|
|
Section string `json:"section"`
|
|
}
|
|
|
|
func loadSpec(t testing.TB, name string) []specExample {
|
|
data, err := os.ReadFile("testdata/" + name)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var ex []specExample
|
|
if err := json.Unmarshal(data, &ex); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
return ex
|
|
}
|
|
|
|
func render(src string, ext Extensions) string {
|
|
d := New(ext)
|
|
d.Set(src)
|
|
return d.HTML()
|
|
}
|
|
|
|
// TestCommonMark runs the examples of the CommonMark spec, 0.31.2.
|
|
func TestCommonMark(t *testing.T) {
|
|
failed := 0
|
|
for _, ex := range loadSpec(t, "commonmark.json") {
|
|
if got := render(ex.Markdown, 0); got != ex.HTML {
|
|
failed++
|
|
t.Errorf("example %d (%s):\n%q\ngot %q\nwant %q", ex.Example, ex.Section, ex.Markdown, got, ex.HTML)
|
|
}
|
|
}
|
|
if failed > 0 {
|
|
t.Logf("%d failed", failed)
|
|
}
|
|
}
|
|
|
|
// TestGFM runs the examples of GitHub's extensions in the GFM spec.
|
|
func TestGFM(t *testing.T) {
|
|
for _, ex := range loadSpec(t, "gfm.json") {
|
|
if !strings.Contains(ex.Section, "(extension)") || ex.Section == "Disallowed Raw HTML (extension)" {
|
|
continue
|
|
}
|
|
if got := render(ex.Markdown, GFM); got != ex.HTML {
|
|
t.Errorf("example %d (%s):\n%q\ngot %q\nwant %q", ex.Example, ex.Section, ex.Markdown, got, ex.HTML)
|
|
}
|
|
}
|
|
}
|