]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/go/doc/example_test.go
[dev.fuzz] all: merge master (d137b74) into dev.fuzz
[gostls13.git] / src / go / doc / example_test.go
index 2d9b95803b1af5844c5289e41a4c60dc0b000319..21b71290f7d4e64ed0e9c9423932ea3e2c3d6eb6 100644 (file)
@@ -358,6 +358,25 @@ func main() {
 }
 `
 
+const exampleWholeFileExternalFunction = `package foo_test
+
+func foo(int)
+
+func Example() {
+       foo(42)
+       // Output:
+}
+`
+
+const exampleWholeFileExternalFunctionOutput = `package main
+
+func foo(int)
+
+func main() {
+       foo(42)
+}
+`
+
 var exampleWholeFileTestCases = []struct {
        Title, Source, Play, Output string
 }{
@@ -373,6 +392,12 @@ var exampleWholeFileTestCases = []struct {
                exampleWholeFileFunctionOutput,
                "Hello, world!\n",
        },
+       {
+               "ExternalFunction",
+               exampleWholeFileExternalFunction,
+               exampleWholeFileExternalFunctionOutput,
+               "",
+       },
 }
 
 func TestExamplesWholeFile(t *testing.T) {