Skip to content

Commit

Permalink
Fix displaying testable example on pkg.go.dev
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear committed Dec 12, 2024
1 parent 342293d commit 24dd0cd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1999,7 +1999,7 @@ w: w_value
}
}

func Example_YAMLTags() {
func ExampleUnmarshal_yAMLTags() {
yml := `---
foo: 1
bar: c
Expand Down Expand Up @@ -2179,7 +2179,7 @@ map: &map
})
}

func Example_JSONTags() {
func ExampleUnmarshal_jSONTags() {
yml := `---
foo: 1
bar: c
Expand All @@ -2198,7 +2198,7 @@ bar: c
// c
}

func Example_DisallowUnknownField() {
func ExampleDecoder_Decode_disallowUnknownField() {
var v struct {
A string `yaml:"simple"`
C string `yaml:"complicated"`
Expand All @@ -2219,7 +2219,7 @@ unknown: string
// ^
}

func Example_Unmarshal_Node() {
func ExampleNodeToValue() {
f, err := parser.ParseBytes([]byte("text: node example"), 0)
if err != nil {
panic(err)
Expand Down
8 changes: 4 additions & 4 deletions encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ func TestEncoder_MultipleDocuments(t *testing.T) {
}
}

func Example_Marshal_Node() {
func ExampleMarshal_node() {
type T struct {
Text ast.Node `yaml:"text"`
}
Expand All @@ -1306,7 +1306,7 @@ func Example_Marshal_Node() {
// text: node example
}

func Example_Marshal_ExplicitAnchorAlias() {
func ExampleMarshal_explicitAnchorAlias() {
type T struct {
A int
B string
Expand All @@ -1329,7 +1329,7 @@ func Example_Marshal_ExplicitAnchorAlias() {
// d: *x
}

func Example_Marshal_ImplicitAnchorAlias() {
func ExampleMarshal_implicitAnchorAlias() {
type T struct {
I int
S string
Expand Down Expand Up @@ -1454,7 +1454,7 @@ func (t TextMarshaler) MarshalText() ([]byte, error) {
return []byte(strconv.FormatInt(int64(t), 8)), nil
}

func Example_MarshalYAML() {
func ExampleMarshal() {
var slow SlowMarshaler
slow.A = "Hello slow poke"
slow.B = 100
Expand Down
4 changes: 2 additions & 2 deletions path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ b: "hello"
// 3 | b: "hello"
}

func ExamplePath_AnnotateSourceWithComment() {
func ExamplePath_AnnotateSource_withComment() {
yml := `
# This is my document
doc:
Expand Down Expand Up @@ -664,7 +664,7 @@ doc:
// 9 | other: value3
}

func ExamplePath_PathString() {
func ExamplePath_Read_pathString() {
yml := `
store:
book:
Expand Down

0 comments on commit 24dd0cd

Please sign in to comment.