mirror of
https://github.com/golang/go
synced 2024-11-21 20:54:45 -07:00
bike/shed: new package.
It comes up often enough that it's time to provide the utility of a standard package. R=r, mirtchovski, adg, rsc, n13m3y3r, ality, go.peter.90, lstoakes, iant, jan.mercl, bsiegert, robert.hencke, rogpeppe, befelemepeseveze, kevlar CC=golang-dev https://golang.org/cl/4557047
This commit is contained in:
parent
0924185840
commit
b5071e92b4
@ -18,6 +18,7 @@ DIRS=\
|
||||
archive/zip\
|
||||
asn1\
|
||||
big\
|
||||
bike/shed\
|
||||
bufio\
|
||||
bytes\
|
||||
cmath\
|
||||
|
11
src/pkg/bike/shed/Makefile
Normal file
11
src/pkg/bike/shed/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
# Copyright 2011 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
include ../../../Make.inc
|
||||
|
||||
TARG=bike/shed
|
||||
GOFILES=\
|
||||
colors.go\
|
||||
|
||||
include ../../../Make.pkg
|
26
src/pkg/bike/shed/colors.go
Normal file
26
src/pkg/bike/shed/colors.go
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
/*
|
||||
Package shed defines colors for bike sheds.
|
||||
|
||||
See http://red.bikeshed.org/ for more details.
|
||||
|
||||
TODO: More colors, colour support, stripes, methods, ponies.
|
||||
*/
|
||||
package shed
|
||||
|
||||
// A Color represents a color, or a colour if you're colonial enough.
|
||||
type Color uint8
|
||||
|
||||
const (
|
||||
Red Color = iota
|
||||
Green
|
||||
Yellow
|
||||
Blue
|
||||
Purple
|
||||
Magenta
|
||||
Chartreuse
|
||||
Cyan
|
||||
)
|
15
src/pkg/bike/shed/colors_test.go
Normal file
15
src/pkg/bike/shed/colors_test.go
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package shed
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCompilerIsNotColorBlind(t *testing.T) {
|
||||
if Red == Green {
|
||||
t.Error("Expected Red != Green, but couldn't distinguish them")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user