Compare commits

...

2 Commits

Author SHA1 Message Date
lilleman cddf81e6a5 Name the relative-sigil rejection where the quick start points, and the struct field a null prefix needs
Tests / vet + fmt + tests (pull_request) Successful in 1m23s
Tests / Gitea release from CHANGELOG.md (pull_request) Has been skipped
Tests / vet + fmt + tests (push) Successful in 7s
Tests / Gitea release from CHANGELOG.md (push) Failing after 14m17s
2026-09-18 20:44:01 +02:00
lilleman 35dc998b03 Test that a fieldless path names its record and the quoting a shell needs 2026-09-18 20:43:37 +02:00
3 changed files with 23 additions and 2 deletions
+2 -1
View File
@@ -53,7 +53,8 @@ replacement, and each removed path, column or flag.
ranges the SSA assigns and carries the columns `area`, `group` and `serial`, so ranges the SSA assigns and carries the columns `area`, `group` and `serial`, so
`--format csv en_US.ssn` writes a header where it used to fail; `en_US.itin` is new `--format csv en_US.ssn` writes a header where it used to fail; `en_US.itin` is new
and carries the same three. `person.prefix` is null where a person has no title, and carries the same three. `person.prefix` is null where a person has no title,
where it used to be an empty string, so `--format sql` writes `NULL`. where it used to be an empty string, so `--format sql` writes `NULL` and a `string`
struct field reading it becomes `*string`.
- `ErrNoColumns` is exported, so a caller can tell the one record fence a path can - `ErrNoColumns` is exported, so a caller can tell the one record fence a path can
answer from the rest. answer from the rest.
- An error names a spelling that runs: a layout is named single-quoted and free of - An error names a spelling that runs: a layout is named single-quoted and free of
+3 -1
View File
@@ -798,7 +798,9 @@ App developers writing tests and fixtures, in Go and at a shell:
library's own advice reachable: the error for an object holding only a format library's own advice reachable: the error for an object holding only a format
names `"…"`, and that spelling has to work where it is printed. An argument or struct names `"…"`, and that spelling has to work where it is printed. An argument or struct
tag of one reference alone, `{/users}`, is refused naming the path `users`: both tag of one reference alone, `{/users}`, is refused naming the path `users`: both
render the same text, and only the path names a record. `IsTemplate` exports the render the same text, and only the path names a record. A folder-relative `{.name}`
or `{..name}` is refused naming `{/name}`, since an inline template sits in no
folder. `IsTemplate` exports the
rule, so the CLI, struct tags and any other caller read one. rule, so the CLI, struct tags and any other caller read one.
- **An inline template skips the cycle fence.** `New` proves the loaded tree - **An inline template skips the cycle fence.** `New` proves the loaded tree
acyclic, an inline node is a finite tree of its own, and nothing in the tree can acyclic, an inline node is a finite tree of its own, and nothing in the tree can
+18
View File
@@ -621,3 +621,21 @@ func TestRunNumbersFollowTheShell(t *testing.T) {
t.Errorf("run(--seed 007 --repeat +3) = %d, %q, stderr %q; want the same as --seed 7 --repeat 3 %q", code, got, errb, want) t.Errorf("run(--seed 007 --repeat +3) = %d, %q, stderr %q; want the same as --seed 7 --repeat 3 %q", code, got, errb, want)
} }
} }
// TestRunRecordOfAFieldlessPath pins the way out of asking a category of one value
// for columns: the record to write, and the quoting a shell needs to take it. The
// argument is well-formed and only the data cannot serve it, so the code is 1.
func TestRunRecordOfAFieldlessPath(t *testing.T) {
code, out, errb := runOut("--format", "csv", "sv_SE.personnummer")
if code != 1 {
t.Fatalf("run(--format csv sv_SE.personnummer) = %d, want 1", code)
}
for _, want := range []string{`{"format":"","personnummer":"{/sv_SE.personnummer}"}`, "single quotes"} {
if !strings.Contains(errb, want) {
t.Errorf("stderr = %q, want it to name %s", errb, want)
}
}
if out != "" {
t.Errorf("stdout = %q, want nothing", out)
}
}