summaryrefslogtreecommitdiff
path: root/libgo/go/cmd/go/testdata/mod/rsc.io_quote_v0.0.0-20180710144737-5d9f230bcfba.txt
blob: 2ebeac397146fa95b166a87c9c458c9df313776e (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
rsc.io/quote@v0.0.0-20180710144737-5d9f230bcfba

-- .mod --
module rsc.io/quote

require (
	rsc.io/quote/v3 v3.0.0
	rsc.io/sampler v1.3.0
)
-- .info --
{"Version":"v0.0.0-20180710144737-5d9f230bcfba","Name":"5d9f230bcfbae514bb6c2215694c2ce7273fc604","Short":"5d9f230bcfba","Time":"2018-07-10T14:47:37Z"}
-- buggy/buggy_test.go --
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package buggy

import "testing"

func Test(t *testing.T) {
	t.Fatal("buggy!")
}
-- go.mod --
module rsc.io/quote

require (
	rsc.io/quote/v3 v3.0.0
	rsc.io/sampler v1.3.0
)
-- quote.go --
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package quote collects pithy sayings.
package quote // import "rsc.io/quote"

import "rsc.io/quote/v3"

// Hello returns a greeting.
func Hello() string {
	return quote.HelloV3()
}

// Glass returns a useful phrase for world travelers.
func Glass() string {
	// See http://www.oocities.org/nodotus/hbglass.html.
	return quote.GlassV3()
}

// Go returns a Go proverb.
func Go() string {
	return quote.GoV3()
}

// Opt returns an optimization truth.
func Opt() string {
	// Wisdom from ken.
	return quote.OptV3()
}
-- quote_test.go --
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package quote

import (
	"os"
	"testing"
)

func init() {
	os.Setenv("LC_ALL", "en")
}

func TestHello(t *testing.T) {
	hello := "Hello, world."
	if out := Hello(); out != hello {
		t.Errorf("Hello() = %q, want %q", out, hello)
	}
}

func TestGlass(t *testing.T) {
	glass := "I can eat glass and it doesn't hurt me."
	if out := Glass(); out != glass {
		t.Errorf("Glass() = %q, want %q", out, glass)
	}
}

func TestGo(t *testing.T) {
	go1 := "Don't communicate by sharing memory, share memory by communicating."
	if out := Go(); out != go1 {
		t.Errorf("Go() = %q, want %q", out, go1)
	}
}

func TestOpt(t *testing.T) {
	opt := "If a program is too slow, it must have a loop."
	if out := Opt(); out != opt {
		t.Errorf("Opt() = %q, want %q", out, opt)
	}
}