Merge Go frontend (apiserver + xcecli) into meson build

This commit is contained in:
Rongsong Shen 2026-04-14 11:20:17 +08:00
parent 43dc12a36c
commit c9dc8c4676
205 changed files with 30793 additions and 328 deletions

View file

@ -0,0 +1,39 @@
package output
import (
"testing"
"time"
)
func TestParseJobTime_RFC3339(t *testing.T) {
got, err := parseJobTime("2026-04-08T17:00:10.159507024+08:00")
if err != nil {
t.Fatal(err)
}
if got.Year() != 2026 || got.Month() != time.April || got.Day() != 8 {
t.Errorf("wrong date: %v", got)
}
}
func TestParseJobTime_SpaceFormat(t *testing.T) {
got, err := parseJobTime("2026-04-08 17:00:10")
if err != nil {
t.Fatal(err)
}
if got.Hour() != 17 {
t.Errorf("wrong hour: %v", got)
}
}
func TestParseJobTime_Empty(t *testing.T) {
if _, err := parseJobTime(""); err == nil {
t.Error("expected error for empty string")
}
}
func TestFormatJobTime(t *testing.T) {
tm := time.Date(2026, time.April, 8, 17, 0, 10, 0, time.UTC)
if got := formatJobTime(tm); got != "Apr 08 17:00" {
t.Errorf("got %q want %q", got, "Apr 08 17:00")
}
}