Text file src/cmd/go/testdata/mod/rsc.io_quote_v0.0.0-20180709160352-0d003b9c4bfa.txt

     1  rsc.io/quote@v0.0.0-20180709160352-0d003b9c4bfa
     2  
     3  -- .mod --
     4  module rsc.io/quote
     5  
     6  require rsc.io/sampler v1.3.0
     7  -- .info --
     8  {"Version":"v0.0.0-20180709160352-0d003b9c4bfa","Name":"0d003b9c4bfac881641be8eb1598b782a467a97f","Short":"0d003b9c4bfa","Time":"2018-07-09T16:03:52Z"}
     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/v2"
    34  
    35  // Hello returns a greeting.
    36  func Hello() string {
    37  	return quote.HelloV2()
    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.GlassV2()
    44  }
    45  
    46  // Go returns a Go proverb.
    47  func Go() string {
    48  	return quote.GoV2()
    49  }
    50  
    51  // Opt returns an optimization truth.
    52  func Opt() string {
    53  	// Wisdom from ken.
    54  	return quote.OptV2()
    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