Initialize blog scaffold
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>
This commit is contained in:
parent
9d2628b318
commit
b78f4b39c9
40 changed files with 9140 additions and 0 deletions
33
backend/internal/cli/config_test.go
Normal file
33
backend/internal/cli/config_test.go
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue