testmark-go

Note the surprising tolerance of this parse and patch system to repeat entry names.

commit 2d2d4c2b793ade8e7a6ca53821337279121f2314 · parent 9242b77037 · browse this tree
Eric Myhre, 2021-08-17 19:36:21 UTC

diff --git a/read.go b/read.go
index 808fee1..9745090 100644
--- a/read.go
+++ b/read.go
@@ -93,6 +93,7 @@ func Parse(data []byte) (*Document, error) {
 				// ... Log a complaint?  Empty block names are very silly.
 			}
 			if already, exists := doc.HunksByName[name]; exists {
+				// You can actually ignore this error, and things will even still mostly work.  HunksByName will only look up the first occurence, and Patch will change only the first occurence, and that is weird, but perhaps fine.
 				return &doc, fmt.Errorf("repeated testmark hunk name %q, first seen on line %d, and again on line %d", name, already.LineStart+1, i+1)
 			}
 			expectCodeBlock = true