libgo: update to Go 1.11
[official-gcc.git] / libgo / go / cmd / go / testdata / mod / rsc.io_quote_v1.5.1.txt
blobeed051bea04f18c2023002dcb5ff3a245c6e8959
1 rsc.io/quote@23179ee8a569
3 -- .mod --
4 module "rsc.io/quote"
6 require "rsc.io/sampler" v1.3.0
7 -- .info --
8 {"Version":"v1.5.1","Name":"23179ee8a569bb05d896ae05c6503ec69a19f99f","Short":"23179ee8a569","Time":"2018-02-14T00:58:40Z"}
9 -- go.mod --
10 module "rsc.io/quote"
12 require "rsc.io/sampler" v1.3.0
13 -- quote.go --
14 // Copyright 2018 The Go Authors. All rights reserved.
15 // Use of this source code is governed by a BSD-style
16 // license that can be found in the LICENSE file.
18 // Package quote collects pithy sayings.
19 package quote // import "rsc.io/quote"
21 import "rsc.io/sampler"
23 // Hello returns a greeting.
24 func Hello() string {
25         return sampler.Hello()
28 // Glass returns a useful phrase for world travelers.
29 func Glass() string {
30         // See http://www.oocities.org/nodotus/hbglass.html.
31         return "I can eat glass and it doesn't hurt me."
34 // Go returns a Go proverb.
35 func Go() string {
36         return "Don't communicate by sharing memory, share memory by communicating."
39 // Opt returns an optimization truth.
40 func Opt() string {
41         // Wisdom from ken.
42         return "If a program is too slow, it must have a loop."
44 -- quote_test.go --
45 // Copyright 2018 The Go Authors. All rights reserved.
46 // Use of this source code is governed by a BSD-style
47 // license that can be found in the LICENSE file.
49 package quote
51 import (
52         "os"
53         "testing"
56 func init() {
57         os.Setenv("LC_ALL", "en")
60 func TestHello(t *testing.T) {
61         hello := "Hello, world."
62         if out := Hello(); out != hello {
63                 t.Errorf("Hello() = %q, want %q", out, hello)
64         }
67 func TestGlass(t *testing.T) {
68         glass := "I can eat glass and it doesn't hurt me."
69         if out := Glass(); out != glass {
70                 t.Errorf("Glass() = %q, want %q", out, glass)
71         }
74 func TestGo(t *testing.T) {
75         go1 := "Don't communicate by sharing memory, share memory by communicating."
76         if out := Go(); out != go1 {
77                 t.Errorf("Go() = %q, want %q", out, go1)
78         }
81 func TestOpt(t *testing.T) {
82         opt := "If a program is too slow, it must have a loop."
83         if out := Opt(); out != opt {
84                 t.Errorf("Opt() = %q, want %q", out, opt)
85         }