1 | rsc.io/QUOTE v1.5.3-PRE (sigh) |
---|---|
2 | |
3 | -- .mod -- |
4 | module rsc.io/QUOTE |
5 | |
6 | require 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 -- |
10 | module rsc.io/QUOTE |
11 | |
12 | require 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. |
19 | package QUOTE |
20 | |
21 | import ( |
22 | "strings" |
23 | |
24 | "rsc.io/quote" |
25 | ) |
26 | |
27 | // HELLO RETURNS A GREETING. |
28 | func HELLO() string { |
29 | return strings.ToUpper(quote.Hello()) |
30 | } |
31 | |
32 | // GLASS RETURNS A USEFUL PHRASE FOR WORLD TRAVELERS. |
33 | func GLASS() string { |
34 | return strings.ToUpper(quote.GLASS()) |
35 | } |
36 | |
37 | // GO RETURNS A GO PROVERB. |
38 | func GO() string { |
39 | return strings.ToUpper(quote.GO()) |
40 | } |
41 | |
42 | // OPT RETURNS AN OPTIMIZATION TRUTH. |
43 | func 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 | |
51 | package QUOTE |
52 | |
53 | import ( |
54 | "os" |
55 | "testing" |
56 | ) |
57 | |
58 | func init() { |
59 | os.Setenv("LC_ALL", "en") |
60 | } |
61 | |
62 | func 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 | |
69 | func 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 | |
76 | func 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 | |
83 | func 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 | } |
89 |
Members