aboutsummaryrefslogtreecommitdiff
path: root/src/go/doc/comment/testdata/README.md
blob: d6f2c549605d2aae2eae1d3ba5ee3d5fce30da7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
This directory contains test files (*.txt) for the comment parser.

The files are in [txtar format](https://pkg.go.dev/golang.org/x/tools/txtar).
Consider this example:

	-- input --
	Hello.
	-- gofmt --
	Hello.
	-- html --
	<p>Hello.
	-- markdown --
	Hello.
	-- text --
	Hello.

Each `-- name --` line introduces a new file with the given name.
The file named “input” must be first and contains the input to
[comment.Parser](https://pkg.go.dev/go/doc/comment/#Parser).

The remaining files contain the expected output for the named format generated by
[comment.Printer](https://pkg.go.dev/go/doc/comment/#Printer):
“gofmt” for Printer.Comment (Go comment format, as used by gofmt),
“html” for Printer.HTML, “markdown” for Printer.Markdown, and “text” for Printer.Text.
The format can also be “dump” for a textual dump of the raw data structures.

The text before the `-- input --` line, if present, is JSON to be unmarshalled
to initialize a comment.Printer. For example, this test case sets the Printer's
TextWidth field to 20:

	{"TextWidth": 20}
	-- input --
	Package gob manages streams of gobs - binary values exchanged between an
	Encoder (transmitter) and a Decoder (receiver).
	-- text --
	Package gob
	manages streams
	of gobs - binary
	values exchanged
	between an Encoder
	(transmitter) and a
	Decoder (receiver).