Files
sanspie 867efcf2f8
ci-platforms / windows amd64 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 / checks (push) Failing after 44m58s
ci-platforms / darwin amd64 smoke (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 12m46s
ci / release (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
GitHub / linux amd64 native GitHub-hosted native CI: success
test: synchronize idle allocations and camera probe
2026-11-10 13:15:15 +03:00

45 lines
1.1 KiB
Go

package scripteditor
import (
"testing"
"aego/script/langsvc"
"aego/script/workspace"
)
func TestRefreshingIncludesQueuedMainCompletion(t *testing.T) {
ws, err := workspace.Open(workspace.Config{Root: t.TempDir(), Module: "game"})
if err != nil {
t.Fatal(err)
}
h := NewHost(langsvc.New(ws, nil))
var workers, main []func()
h.d = Deps{
Submit: func(fn func()) { workers = append(workers, fn) },
OnMain: func(fn func()) { main = append(main, fn) },
}
if h.Refreshing() {
t.Fatal("a new host must not be refreshing")
}
h.refresh(1)
if !h.Refreshing() || len(workers) != 1 {
t.Fatal("the queued language refresh was not reported")
}
h.refresh(2)
if len(workers) != 1 {
t.Fatal("a second refresh started while the first was in flight")
}
workers[0]()
if !h.Refreshing() || len(main) != 1 {
t.Fatal("refresh must remain active until its main-thread completion")
}
main[0]()
if h.Refreshing() {
t.Fatal("completed language refresh remained active")
}
h.refresh(3)
if h.Refreshing() || len(workers) != 1 {
t.Fatal("an unchanged language workspace started another refresh")
}
}