aboutsummaryrefslogtreecommitdiff
path: root/tests/core/go_test/example_test.go
blob: 6314e69ca459a45da4e20832ca109a470df9edb6 (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
package lib

import "fmt"

var Expected = "Expected"

func ExampleHelloWorld() {
	fmt.Println("Hello Example!")
	fmt.Println("expected: " + Expected)
	fmt.Println("got: " + Got)
	// Output:
	// Hello Example!
	// expected: Example
	// got: Example
}

func ExampleDontTestMe() {
	panic("Dont Test Me!")
}

func ExampleTestEmptyOutput() {
	if false {
		fmt.Println("Say something!")
	}
	// Output:
}

func ExampleTestQuoting() {
	fmt.Printf(`"quotes are handled"`)
	// Output:
	// "quotes are handled"
}