Text file src/cmd/go/testdata/mod/rsc.io_quote_v1.5.3-pre1.txt

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

View as plain text