...
Text file
src/cmd/go/testdata/mod/rsc.io_!q!u!o!t!e_v1.5.3-!p!r!e.txt
1rsc.io/QUOTE v1.5.3-PRE (sigh)
2
3-- .mod --
4module rsc.io/QUOTE
5
6require rsc.io/quote v1.5.2
7-- .info --
8{"Version":"v1.5.3-PRE","Name":"","Short":"","Time":"2018-07-15T16:25:34Z"}
9-- go.mod --
10module rsc.io/QUOTE
11
12require rsc.io/quote v1.5.2
13-- QUOTE/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.
17
18// PACKAGE QUOTE COLLECTS LOUD SAYINGS.
19package QUOTE
20
21import (
22 "strings"
23
24 "rsc.io/quote"
25)
26
27// HELLO RETURNS A GREETING.
28func HELLO() string {
29 return strings.ToUpper(quote.Hello())
30}
31
32// GLASS RETURNS A USEFUL PHRASE FOR WORLD TRAVELERS.
33func GLASS() string {
34 return strings.ToUpper(quote.GLASS())
35}
36
37// GO RETURNS A GO PROVERB.
38func GO() string {
39 return strings.ToUpper(quote.GO())
40}
41
42// OPT RETURNS AN OPTIMIZATION TRUTH.
43func OPT() string {
44 return strings.ToUpper(quote.OPT())
45}
46-- QUOTE/quote_test.go --
47// Copyright 2018 The Go Authors. All rights reserved.
48// Use of this source code is governed by a BSD-style
49// license that can be found in the LICENSE file.
50
51package QUOTE
52
53import (
54 "os"
55 "testing"
56)
57
58func init() {
59 os.Setenv("LC_ALL", "en")
60}
61
62func TestHELLO(t *testing.T) {
63 hello := "HELLO, WORLD"
64 if out := HELLO(); out != hello {
65 t.Errorf("HELLO() = %q, want %q", out, hello)
66 }
67}
68
69func TestGLASS(t *testing.T) {
70 glass := "I CAN EAT GLASS AND IT DOESN'T HURT ME."
71 if out := GLASS(); out != glass {
72 t.Errorf("GLASS() = %q, want %q", out, glass)
73 }
74}
75
76func TestGO(t *testing.T) {
77 go1 := "DON'T COMMUNICATE BY SHARING MEMORY, SHARE MEMORY BY COMMUNICATING."
78 if out := GO(); out != go1 {
79 t.Errorf("GO() = %q, want %q", out, go1)
80 }
81}
82
83func TestOPT(t *testing.T) {
84 opt := "IF A PROGRAM IS TOO SLOW, IT MUST HAVE A LOOP."
85 if out := OPT(); out != opt {
86 t.Errorf("OPT() = %q, want %q", out, opt)
87 }
88}
View as plain text