| 1 |
rsc.io/[email protected] |
| 2 |
|
| 3 |
-- .mod -- |
| 4 |
module "rsc.io/quote" |
| 5 |
-- .info -- |
| 6 |
{"Version":"v1.1.0","Name":"cfd7145f43f92a8d56b4a3dd603795a3291381a9","Short":"cfd7145f43f9","Time":"2018-02-14T00:46:44Z"} |
| 7 |
-- go.mod -- |
| 8 |
module "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. |
| 15 |
package quote // import "rsc.io/quote" |
| 16 |
|
| 17 |
// Hello returns a greeting. |
| 18 |
func Hello() string { |
| 19 |
return "Hello, world." |
| 20 |
} |
| 21 |
|
| 22 |
// Glass returns a useful phrase for world travelers. |
| 23 |
func 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 |
-- quote_test.go -- |
| 28 |
// Copyright 2018 The Go Authors. All rights reserved. |
| 29 |
// Use of this source code is governed by a BSD-style |
| 30 |
// license that can be found in the LICENSE file. |
| 31 |
|
| 32 |
package quote |
| 33 |
|
| 34 |
import "testing" |
| 35 |
|
| 36 |
func TestHello(t *testing.T) { |
| 37 |
hello := "Hello, world." |
| 38 |
if out := Hello(); out != hello { |
| 39 |
t.Errorf("Hello() = %q, want %q", out, hello) |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
func TestGlass(t *testing.T) { |
| 44 |
glass := "I can eat glass and it doesn't hurt me." |
| 45 |
if out := Glass(); out != glass { |
| 46 |
t.Errorf("Glass() = %q, want %q", out, glass) |
| 47 |
} |
| 48 |
} |