Add the CLI, site, and sample content so the project can run locally. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
33 lines
837 B
Go
33 lines
837 B
Go
package cli
|
|
|
|
import "testing"
|
|
|
|
func TestChangedConfigFields(t *testing.T) {
|
|
var a siteConfigFile
|
|
a.Meta.ConfigVersion = 1
|
|
a.Meta.UpdatedAt = "2026-05-28T12:00:00+08:00"
|
|
a.Site.Title = "A"
|
|
a.Content.PostsDir = "content/posts"
|
|
a.Build.OutputDir = "dist/site"
|
|
|
|
b := a
|
|
if fields := changedConfigFields(a, b); len(fields) != 0 {
|
|
t.Fatalf("unchanged config fields = %#v", fields)
|
|
}
|
|
|
|
b.Site.Title = "B"
|
|
b.Build.OutputDir = "dist/other"
|
|
fields := changedConfigFields(a, b)
|
|
if len(fields) != 2 || fields[0] != "site.title" || fields[1] != "build.output_dir" {
|
|
t.Fatalf("changed fields = %#v", fields)
|
|
}
|
|
}
|
|
|
|
func TestParseTime(t *testing.T) {
|
|
if _, ok := parseTime("2026-05-28T12:00:00+08:00"); !ok {
|
|
t.Fatal("expected RFC3339 time to parse")
|
|
}
|
|
if _, ok := parseTime("not-time"); ok {
|
|
t.Fatal("expected invalid time")
|
|
}
|
|
}
|