You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
adonovan
changed the title
x/pkgsite: "// Output:" matcher in test Examples is noncanonical
x/pkgsite: "// Output:" matcher for test Examples is noncanonical
Feb 2, 2024
The standard logic for extracting "// Output:" comments in example tests is here:
https://cs.opensource.google/go/go/+/master:src/go/doc/example.go;l=113;drc=28f1bf61b7383bd4079d77090e67b3198b75be12
Observe that it has a
^
anchor so that it matches only the start of the comment text.By contrast, pksite uses this regexp:
https://cs.opensource.google/go/x/pkgsite/+/master:internal/godoc/dochtml/internal/render/render.go;l=24;drc=7431aa5932c48bce425bf3f2dc368c5b1fed6e2c
which lacks the anchor. The consequence is that an example such as this one:
is considered executable by pkgsite, and its rendering of the example is abruptly cut off at line C.
The text was updated successfully, but these errors were encountered: