feat: release v0.26 portable i18n and presentation adapters

This commit is contained in:
2026-09-29 13:31:42 +08:00
parent 6a95cad184
commit d1a747c36f
75 changed files with 5681 additions and 52 deletions

View File

@@ -0,0 +1,34 @@
package main
import (
"net/http/httptest"
"strings"
"testing"
)
func TestIndependentExampleAndHTTP(t *testing.T) {
b, err := bundle()
if err != nil {
t.Fatal(err)
}
if missing := b.Check(); len(missing) != 0 {
t.Fatal(missing)
}
a, err := application(b)
if err != nil {
t.Fatal(err)
}
defer a.Close()
for _, test := range []struct {
path, part string
status int
}{{"/api/limit", "数量不能超过 100", 409}, {"/locales/zh-Hans.json", `"namespace": "ui"`, 200}, {"/runtime.mjs", "createLanguageController", 200}, {"/", "draft", 200}} {
w := httptest.NewRecorder()
r := httptest.NewRequest("GET", test.path, nil)
r.Header.Set("Accept-Language", "zh-CN")
a.ServeHTTP(w, r)
if w.Code != test.status || !strings.Contains(w.Body.String(), test.part) {
t.Fatal(test.path, w.Code, w.Body.String())
}
}
}