diff options
Diffstat (limited to 'internal/api/testdata/html-examples.golden')
| -rw-r--r-- | internal/api/testdata/html-examples.golden | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/internal/api/testdata/html-examples.golden b/internal/api/testdata/html-examples.golden new file mode 100644 index 00000000..fd6e0682 --- /dev/null +++ b/internal/api/testdata/html-examples.golden @@ -0,0 +1,155 @@ +<h1>package pkg</h1> + +<p>Package pkg has every form of declaration. +<h3 id="hdr-Heading">Heading</h3> +<p>Search <a href="https://google.com">Google</a> for details. +<h3 id="hdr-Links">Links</h3> +<ul> +<li>pkgsite repo, <a href="https://go.googlesource.com/pkgsite">https://go.googlesource.com/pkgsite</a> +<li>Play with Go, <a href="https://play-with-go.dev">https://play-with-go.dev</a> +</ul> + +<h4>Example</h4> + +<pre><code> +{ + fmt.Println("Package example") + +} +</code></pre> +Output: + +<pre><code> +Package example + +</code></pre> + +<h2>Constants</h2> + +<pre><code>const ( + X = 1 + Y = 2 +)</code></pre> +<p>Several constants. + +<pre><code>const C = 1</code></pre> +<p>C is a shorthand for 1. + +<h2>Variables</h2> + +<pre><code>var V = 2</code></pre> +<p>V is a variable. + +<h2>Functions</h2> + +<pre><code>func Add(x int) int</code></pre> +<p>Add adds 1 to x. + +<pre><code>func F()</code></pre> +<p>F is a function. + +<h4>Example</h4> + +<pre><code> +{ + pkg.F() + fmt.Println("F example") + +} +</code></pre> +Output: + +<pre><code> +F example + +</code></pre> + +<h4>Example (second)</h4> + +<pre><code> +{ + pkg.F() + fmt.Println("F second example") + +} +</code></pre> +Output: + +<pre><code> +F second example + +</code></pre> + +<h2>Types</h2> + +<pre><code>type A int</code></pre> + +<pre><code>type B bool</code></pre> + +<pre><code>type I1 interface { + M1() +}</code></pre> +<p>I1 is an interface. + +<pre><code>type I2 interface { + I1 + M2() +}</code></pre> + +<pre><code>type S1 struct { + F int // field +}</code></pre> +<p>S1 is a struct. + +<pre><code>type S2 struct { + S1 + G int +}</code></pre> +<p>S2 is another struct. + +<pre><code>type T int</code></pre> +<p>T is a type. + +<h4>Example</h4> + +<pre><code> +{ + _ = pkg.T(0) + fmt.Println("T example") + +} +</code></pre> +Output: + +<pre><code> +T example + +</code></pre> + +<pre><code>const CT T = 3</code></pre> +<p>CT is a typed constant. +They appear after their type. + +<pre><code>func TF() T</code></pre> +<p>TF is a constructor for T. + +<pre><code>func (T) M()</code></pre> +<p>M is a method of T. +BUG(xxx): this verifies that notes are rendered. + +<h4>Example</h4> + +<pre><code> +{ + var t pkg.T + t.M() + fmt.Println("M example") + +} +</code></pre> +Output: + +<pre><code> +M example + +</code></pre> |
