...
1rsc.io/quote@v1.2.1
2
3-- .mod --
4module "rsc.io/quote"
5-- .info --
6{"Version":"v1.2.1","Name":"5c1f03b64ab7aa958798a569a31924655dc41e76","Short":"5c1f03b64ab7","Time":"2018-02-14T00:54:20Z"}
7-- go.mod --
8module "rsc.io/quote"
9-- quote.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
14// Package quote collects pithy sayings.
15package quote // import "rsc.io/quote"
16
17// Hello returns a greeting.
18func Hello() string {
19 return "Hello, world."
20}
21
22// Glass returns a useful phrase for world travelers.
23func Glass() string {
24 // See http://www.oocities.org/nodotus/hbglass.html.
25 return "I can eat glass and it doesn't hurt me."
26}
27
28// Go returns a Go proverb.
29func Go() string {
30 return "Don't communicate by sharing memory, share memory by communicating."
31}
32-- quote_test.go --
33// Copyright 2018 The Go Authors. All rights reserved.
34// Use of this source code is governed by a BSD-style
35// license that can be found in the LICENSE file.
36
37package quote
38
39import "testing"
40
41func TestHello(t *testing.T) {
42 hello := "Hello, world."
43 if out := Hello(); out != hello {
44 t.Errorf("Hello() = %q, want %q", out, hello)
45 }
46}
47
48func TestGlass(t *testing.T) {
49 glass := "I can eat glass and it doesn't hurt me."
50 if out := Glass(); out != glass {
51 t.Errorf("Glass() = %q, want %q", out, glass)
52 }
53}
54
55func TestGo(t *testing.T) {
56 go1 := "Don't communicate by sharing memory, share memory by communicating."
57 if out := Go(); out != go1 {
58 t.Errorf("Go() = %q, want %q", out, go1)
59 }
60}
View as plain text