Rewrite the code comments for consistent tone and accuracy

Comments only: the tokens of every Go file are unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 19:08:00 +00:00
co-authored by Claude Sonnet 5.5
parent 41f752e1c1
commit 158661eefe
27 changed files with 716 additions and 437 deletions
+13
View File
@@ -6,6 +6,7 @@ import (
"testing"
)
// write writes a document with the options, and fails the test if it can't.
func write(t *testing.T, doc *Document, opts WriteOptions) string {
t.Helper()
var b strings.Builder
@@ -21,6 +22,9 @@ var writeFiles = map[string]string{
const writeMain = "#define $S kick\n#include \"x.sfz\"\n#define $S snare\n<region> sample=$S.wav\n"
// TestWriteZeroValue checks that the zero value of WriteOptions writes each
// file as it was read, and that Write refuses to lose the files a document
// includes.
func TestWriteZeroValue(t *testing.T) {
doc := mustParse(t, writeMain, writeFiles)
// Written to files, each file is as it was read.
@@ -75,6 +79,8 @@ func TestIncludedTwiceEdited(t *testing.T) {
}
}
// TestExpandVariablesKeepsComments checks that ExpandVariables leaves the
// text of comments as it is.
func TestExpandVariablesKeepsComments(t *testing.T) {
doc := mustParse(t, "#define $A 1\n// uses $A\n/* $A */<region> sample=$A.wav // $A\n", nil)
want := "// uses $A\n/* $A */<region> sample=1.wav // $A\n"
@@ -83,6 +89,8 @@ func TestExpandVariablesKeepsComments(t *testing.T) {
}
}
// TestInlineIncludes checks that InlineIncludes writes one file that reads as
// the document did.
func TestInlineIncludes(t *testing.T) {
doc := mustParse(t, writeMain, writeFiles)
got := write(t, doc, WriteOptions{InlineIncludes: true})
@@ -97,6 +105,9 @@ func TestInlineIncludes(t *testing.T) {
}
}
// TestExpandVariables checks that ExpandVariables writes each variable's value
// as of where it is used, and returns an error where the files can't be written
// with them expanded.
func TestExpandVariables(t *testing.T) {
doc := mustParse(t, writeMain, writeFiles)
got := write(t, doc, WriteOptions{InlineIncludes: true, ExpandVariables: true})
@@ -127,6 +138,8 @@ func TestExpandVariables(t *testing.T) {
}
}
// TestLineEndings checks that LineEnding sets the line breaks that are
// written, and that the zero value keeps them.
func TestLineEndings(t *testing.T) {
doc := mustParse(t, "<region>\r\nsample=a.wav\n", nil)
if got := write(t, doc, WriteOptions{LineEnding: LF}); got != "<region>\nsample=a.wav\n" {