ci-platforms / darwin amd64 smoke (push) Skipped
GitHub / linux amd64 native GitHub-hosted native CI: success
ci-platforms / windows amd64 smoke (push) Skipped
GitHub / windows amd64 native GitHub-hosted native CI: success
GitHub / darwin arm64 native GitHub-hosted native CI: success
GitHub / darwin amd64 native GitHub-hosted native CI: success
ci / checks (push) Failing after 1h21m34s
ci / native-authoring (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
github-native / gitea-pending (push) Skipped
github-native / darwin amd64 native (push) Skipped
github-native / linux amd64 native (push) Skipped
github-native / windows amd64 native (push) Skipped
github-native / darwin arm64 native (push) Skipped
github-native / gitea-result (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 12m4s
ci / release (push) Skipped
Add dockable Art tools, animation and previews, guarded asset workflows, and the Web Asset Studio built on the shared Art Core. Expand English and Russian documentation, interactive Try scenes, examples and editor icons. Add audio waveform navigation, source analysis, guarded previews and a browser Worker mixer. Preserve source changes and recovery with bounded checks, and strengthen native, browser and interoperability CI. Prepare version 0.12.5 and manually built native artifact candidates. Fix the production site image demo build dependency. Reuse immutable scene indices when capturing keyframes. Wait for real Persist save/load completion in component tests. Stabilize browser Game View captures outside pointer hover. Aseprite interchange and persistent Audio EDL recovery remain limited; the artifact workflow does not publish releases or change stable.
115 lines
4.9 KiB
Go
115 lines
4.9 KiB
Go
package site
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func diagFixture() *Export {
|
|
exp := fixture()
|
|
for i := range exp.Entries {
|
|
if exp.Entries[i].ID == "AES2050" {
|
|
exp.Entries[i].Summary = "yield outside a coroutine."
|
|
exp.Entries[i].Diag = &DiagInfo{
|
|
Phase: "Coroutines, signals and events", Fix: "Declare it with `coroutine`.", File: "demo/main.aes",
|
|
Bad: "package demo\n\nscript Blink {\n\tfunc Ready() {\n\t\tyield wait(0.5)\n\t}\n}\n",
|
|
Good: "package demo\n\nscript Blink {\n\tfunc Later() coroutine {\n\t\tyield wait(0.5)\n\t}\n}\n",
|
|
Severity: "error", At: "demo/main.aes", Line: 5, Col: 3, EndLine: 5, EndCol: 18,
|
|
Message: "yield is only allowed in a coroutine",
|
|
}
|
|
}
|
|
}
|
|
exp.Entries = append(exp.Entries,
|
|
Entry{ID: "AES2031", Parent: "diagnostics", Kind: KindCode, Group: "diagnostics", Title: "AES2031", Summary: "Unused variable.",
|
|
Diag: &DiagInfo{Phase: "Types", Fix: "Use it.", File: "demo/main.aes",
|
|
Bad: "package demo\n\nfunc F() {\n\tx := 1\n}\n", Good: "package demo\n\nfunc F() {\n}\n",
|
|
Severity: "warning", At: "demo/main.aes", Line: 4, Col: 2, EndLine: 4, EndCol: 3, Message: "x declared and not used"}},
|
|
Entry{ID: "AES6002", Parent: "diagnostics", Kind: KindCode, Group: "diagnostics", Title: "AES6002", Summary: "A native binding panicked.",
|
|
Diag: &DiagInfo{Phase: "Runtime faults", Fix: "Fix the Go function.", Why: "Raised when Go code panics."}},
|
|
)
|
|
for gi := range exp.Groups {
|
|
if exp.Groups[gi].ID == "diagnostics" {
|
|
nav := &exp.Groups[gi].Nav[0]
|
|
nav.Children = []Node{{ID: "AES2031"}, {ID: "AES2050"}, {ID: "AES6002"}}
|
|
}
|
|
}
|
|
return exp
|
|
}
|
|
|
|
func TestDiagnosticsPage(t *testing.T) {
|
|
_, _, pages := build(t, diagFixture(), Options{})
|
|
p := pages["diagnostics.html"]
|
|
for _, want := range []string{
|
|
`<a href="#phase-types">Types</a>`,
|
|
`<a href="#AES2050">AES2050</a>`,
|
|
`<h2 id="phase-coroutines-signals-and-events">Coroutines, signals and events</h2>`,
|
|
`<h3 class="diag-head" id="AES2050"><a class="anchor" href="#AES2050">AES2050</a><span class="sev sev-error">error</span></h3>`,
|
|
`<span class="sev sev-warning">warning</span>`,
|
|
`<span class="hl-line">`,
|
|
`<span class="hl-span"><span class="t-kw">yield</span> `,
|
|
`<div class="diag-msg">demo/main.aes:5:3: AES2050 yield is only allowed in a coroutine</div>`,
|
|
`<div class="diag-msg warning">demo/main.aes:4:2: AES2031 x declared and not used</div>`,
|
|
`<strong>Fix:</strong> Declare it with <code>coroutine</code>.`,
|
|
`<p class="label">Fixed</p>`,
|
|
`<p class="label">No example</p>`,
|
|
`Raised when Go code panics.`,
|
|
} {
|
|
if !strings.Contains(p, want) {
|
|
t.Errorf("diagnostics page has no %s", want)
|
|
}
|
|
}
|
|
if strings.Count(p, `class="hl-line"`) != 2 {
|
|
t.Errorf("want one marked line per broken example, got %d", strings.Count(p, `class="hl-line"`))
|
|
}
|
|
if i, j := strings.Index(p, `id="AES2031"`), strings.Index(p, `id="AES2050"`); i < 0 || j < i {
|
|
t.Error("codes are not grouped in order")
|
|
}
|
|
}
|
|
|
|
func TestDiagnosticsContentsUsesPhasesInsteadOfRepeatedDetails(t *testing.T) {
|
|
exp := diagFixture()
|
|
for _, id := range []string{"PHY001", "PHY002"} {
|
|
exp.Entries = append(exp.Entries, Entry{
|
|
ID: id, Parent: "diagnostics", Kind: KindCode, Group: "diagnostics", Title: id,
|
|
Body: "## Details\n\nDetailed explanation.",
|
|
Diag: &DiagInfo{Phase: "scene"},
|
|
Translations: map[string]Translation{"ru": {Body: "## Подробности\n\nОписание."}},
|
|
})
|
|
}
|
|
for i := range exp.Groups {
|
|
if exp.Groups[i].ID == "diagnostics" {
|
|
exp.Groups[i].Nav[0].Children = append(exp.Groups[i].Nav[0].Children, Node{ID: "PHY001"}, Node{ID: "PHY002"})
|
|
}
|
|
}
|
|
_, _, pages := build(t, exp, Options{})
|
|
for _, name := range []string{"diagnostics.html", "ru/diagnostics.html"} {
|
|
p := pages[name]
|
|
start, end := strings.Index(p, `<aside class="toc">`), strings.Index(p, `</aside>`)
|
|
if start < 0 || end < start {
|
|
t.Fatalf("%s: no table of contents", name)
|
|
}
|
|
toc := p[start:end]
|
|
if !strings.Contains(toc, `href="#phase-scene"`) || strings.Contains(toc, `href="#details"`) {
|
|
t.Errorf("%s: table of contents should list phases, not repeated Details: %s", name, toc)
|
|
}
|
|
for _, id := range []string{"PHY001-details", "PHY002-details"} {
|
|
if n := strings.Count(p, `id="`+id+`"`); n != 1 {
|
|
t.Errorf("%s: expected one unique detail heading %s, got %d", name, id, n)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestHighlightMarked(t *testing.T) {
|
|
got := highlightMarked("a := \"жx\"\nb := 1\n", 1, 8, 1, 9)
|
|
if !strings.HasPrefix(got, `<span class="hl-line">`) || !strings.Contains(got, `"ж</span><span class="hl-span"><span class="t-str">x</span></span>`) {
|
|
t.Fatalf("marked line: %s", got)
|
|
}
|
|
if strings.Count(got, "hl-line") != 1 || !strings.Contains(got, "</span></span>\nb ") {
|
|
t.Fatalf("other lines: %s", got)
|
|
}
|
|
if got := highlightMarked("x\n", 1, 0, 0, 0); strings.Contains(got, "hl-span") || !strings.Contains(got, "hl-line") {
|
|
t.Fatalf("fault without a column: %s", got)
|
|
}
|
|
}
|