...
Text file
src/cmd/go/testdata/mod/rsc.io_quote_v0.0.0-20180709162918-a91498bed0a7.txt
1rsc.io/quote@v0.0.0-20180709162918-a91498bed0a7
2
3-- .mod --
4module rsc.io/quote
5
6require rsc.io/sampler v1.3.0
7-- .info --
8{"Version":"v0.0.0-20180709162918-a91498bed0a7","Name":"a91498bed0a73d4bb9c1fb2597925f7883bc40a7","Short":"a91498bed0a7","Time":"2018-07-09T16:29:18Z"}
9-- buggy/buggy_test.go --
10// Copyright 2018 The Go Authors. All rights reserved.
11// Use of this source code is governed by a BSD-style
12// license that can be found in the LICENSE file.
13
14package buggy
15
16import "testing"
17
18func Test(t *testing.T) {
19 t.Fatal("buggy!")
20}
21-- go.mod --
22module rsc.io/quote
23
24require rsc.io/sampler v1.3.0
25-- quote.go --
26// Copyright 2018 The Go Authors. All rights reserved.
27// Use of this source code is governed by a BSD-style
28// license that can be found in the LICENSE file.
29
30// Package quote collects pithy sayings.
31package quote // import "rsc.io/quote"
32
33import "rsc.io/quote/v3"
34
35// Hello returns a greeting.
36func Hello() string {
37 return quote.HelloV3()
38}
39
40// Glass returns a useful phrase for world travelers.
41func Glass() string {
42 // See http://www.oocities.org/nodotus/hbglass.html.
43 return quote.GlassV3()
44}
45
46// Go returns a Go proverb.
47func Go() string {
48 return quote.GoV3()
49}
50
51// Opt returns an optimization truth.
52func Opt() string {
53 // Wisdom from ken.
54 return quote.OptV3()
55}
56-- quote_test.go --
57// Copyright 2018 The Go Authors. All rights reserved.
58// Use of this source code is governed by a BSD-style
59// license that can be found in the LICENSE file.
60
61package quote
62
63import (
64 "os"
65 "testing"
66)
67
68func init() {
69 os.Setenv("LC_ALL", "en")
70}
71
72func TestHello(t *testing.T) {
73 hello := "Hello, world."
74 if out := Hello(); out != hello {
75 t.Errorf("Hello() = %q, want %q", out, hello)
76 }
77}
78
79func TestGlass(t *testing.T) {
80 glass := "I can eat glass and it doesn't hurt me."
81 if out := Glass(); out != glass {
82 t.Errorf("Glass() = %q, want %q", out, glass)
83 }
84}
85
86func TestGo(t *testing.T) {
87 go1 := "Don't communicate by sharing memory, share memory by communicating."
88 if out := Go(); out != go1 {
89 t.Errorf("Go() = %q, want %q", out, go1)
90 }
91}
92
93func TestOpt(t *testing.T) {
94 opt := "If a program is too slow, it must have a loop."
95 if out := Opt(); out != opt {
96 t.Errorf("Opt() = %q, want %q", out, opt)
97 }
98}
View as plain text