...
1rsc.io/quote@v1.2.0
2
3-- .mod --
4module "rsc.io/quote"
5-- .info --
6{"Version":"v1.2.0","Name":"d8a3de91045c932a1c71e545308fe97571d6d65c","Short":"d8a3de91045c","Time":"2018-02-14T00:47:51Z"}
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
55// Go returns a Go proverb.
56func TestGo(t *testing.T) {
57 go1 := "Don't communicate by sharing memory. Share memory by communicating."
58 if out := Go(); out != go1 {
59 t.Errorf("Go() = %q, want %q", out, go1)
60 }
61}
View as plain text