Skip to content

Commit

Permalink
Added failing test case for golang#42706
Browse files Browse the repository at this point in the history
  • Loading branch information
qbradq committed Nov 30, 2020
1 parent 4ce0a7c commit bd7c640
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/go/doc/example_test.go
Expand Up @@ -352,6 +352,26 @@ func main() {
}
`

const exampleWholeFileExternalFunction = `package foo_test
func foo(x int)
func Example() {
foo(42) // External function reference
fmt.Println("Hello, world!")
// Output: Hello, world!
}
`

const exampleWholeFileExternalFunctionOutput = `package main
func foo(x int)
func main() {
fmt.Println("Hello, world!")
}
`

var exampleWholeFileTestCases = []struct {
Title, Source, Play, Output string
}{
Expand All @@ -367,6 +387,12 @@ var exampleWholeFileTestCases = []struct {
exampleWholeFileFunctionOutput,
"Hello, world!\n",
},
{
"ExternalFunction",
exampleWholeFileExternalFunction,
exampleWholeFileExternalFunctionOutput,
"Hello, world!\n",
},
}

func TestExamplesWholeFile(t *testing.T) {
Expand Down

0 comments on commit bd7c640

Please sign in to comment.