...

Text file src/cmd/go/testdata/mod/rsc.io_quote_v0.0.0-20180709162749-b44a0b17b2d1.txt

Documentation: cmd/go/testdata/mod

     1rsc.io/quote@v0.0.0-20180709162749-b44a0b17b2d1
     2
     3-- .mod --
     4module rsc.io/quote
     5
     6require (
     7	rsc.io/quote/v2 v2.0.1
     8	rsc.io/sampler v1.3.0
     9)
    10-- .info --
    11{"Version":"v0.0.0-20180709162749-b44a0b17b2d1","Name":"b44a0b17b2d1fe4c98a8d0e7a68c9bf9e762799a","Short":"b44a0b17b2d1","Time":"2018-07-09T16:27:49Z"}
    12-- buggy/buggy_test.go --
    13// Copyright 2018 The Go Authors. All rights reserved.
    14// Use of this source code is governed by a BSD-style
    15// license that can be found in the LICENSE file.
    16
    17package buggy
    18
    19import "testing"
    20
    21func Test(t *testing.T) {
    22	t.Fatal("buggy!")
    23}
    24-- go.mod --
    25module rsc.io/quote
    26
    27require (
    28	rsc.io/quote/v2 v2.0.1
    29	rsc.io/sampler v1.3.0
    30)
    31-- quote.go --
    32// Copyright 2018 The Go Authors. All rights reserved.
    33// Use of this source code is governed by a BSD-style
    34// license that can be found in the LICENSE file.
    35
    36// Package quote collects pithy sayings.
    37package quote // import "rsc.io/quote"
    38
    39import "rsc.io/quote/v2"
    40
    41// Hello returns a greeting.
    42func Hello() string {
    43	return quote.HelloV2()
    44}
    45
    46// Glass returns a useful phrase for world travelers.
    47func Glass() string {
    48	// See http://www.oocities.org/nodotus/hbglass.html.
    49	return quote.GlassV2()
    50}
    51
    52// Go returns a Go proverb.
    53func Go() string {
    54	return quote.GoV2()
    55}
    56
    57// Opt returns an optimization truth.
    58func Opt() string {
    59	// Wisdom from ken.
    60	return quote.OptV2()
    61}
    62-- quote_test.go --
    63// Copyright 2018 The Go Authors. All rights reserved.
    64// Use of this source code is governed by a BSD-style
    65// license that can be found in the LICENSE file.
    66
    67package quote
    68
    69import (
    70	"os"
    71	"testing"
    72)
    73
    74func init() {
    75	os.Setenv("LC_ALL", "en")
    76}
    77
    78func TestHello(t *testing.T) {
    79	hello := "Hello, world."
    80	if out := Hello(); out != hello {
    81		t.Errorf("Hello() = %q, want %q", out, hello)
    82	}
    83}
    84
    85func TestGlass(t *testing.T) {
    86	glass := "I can eat glass and it doesn't hurt me."
    87	if out := Glass(); out != glass {
    88		t.Errorf("Glass() = %q, want %q", out, glass)
    89	}
    90}
    91
    92func TestGo(t *testing.T) {
    93	go1 := "Don't communicate by sharing memory, share memory by communicating."
    94	if out := Go(); out != go1 {
    95		t.Errorf("Go() = %q, want %q", out, go1)
    96	}
    97}
    98
    99func TestOpt(t *testing.T) {
   100	opt := "If a program is too slow, it must have a loop."
   101	if out := Opt(); out != opt {
   102		t.Errorf("Opt() = %q, want %q", out, opt)
   103	}
   104}

View as plain text