Text file src/cmd/go/testdata/mod/rsc.io_quote_v0.0.0-20180709162918-a91498bed0a7.txt

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

View as plain text