Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestStatementsExample(t *testing.T) {
|
||||
in := strings.NewReader(`title = "demo"
|
||||
port = 8080
|
||||
|
||||
[server]
|
||||
host = "127.0.0.1"
|
||||
|
||||
[[items]]
|
||||
name = "a"
|
||||
|
||||
[[items]]
|
||||
name = "b"
|
||||
`)
|
||||
var out strings.Builder
|
||||
if err := run(in, &out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, want := range []string{
|
||||
"title = demo",
|
||||
"port = 8080",
|
||||
"[server] keys: [host]",
|
||||
"[[items]] #0",
|
||||
"[[items]] #1",
|
||||
} {
|
||||
if !strings.Contains(out.String(), want) {
|
||||
t.Errorf("output missing %q:\n%s", want, out.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user