Fix some tests

This commit is contained in:
tidwall 2018-10-22 14:52:48 -07:00
parent a9a1612972
commit ccd6975f5f
2 changed files with 38 additions and 9 deletions

View File

@ -8,7 +8,7 @@ import (
)
func LO(points []geometry.Point) *geojson.LineString {
return geojson.NewLineString(geometry.NewLine(points, geometry.DefaultIndex))
return geojson.NewLineString(geometry.NewLine(points, nil))
}
func RO(minX, minY, maxX, maxY float64) *geojson.Rect {
@ -19,7 +19,7 @@ func RO(minX, minY, maxX, maxY float64) *geojson.Rect {
}
func PPO(exterior []geometry.Point, holes [][]geometry.Point) *geojson.Polygon {
return geojson.NewPolygon(geometry.NewPoly(exterior, holes, geometry.DefaultIndex))
return geojson.NewPolygon(geometry.NewPoly(exterior, holes, nil))
}
func TestClipLineStringSimple(t *testing.T) {

View File

@ -19,7 +19,7 @@ var tty bool
// 1: normal - show everything except debug and warn
// 2: verbose - show everything except debug
// 3: very verbose - show everything
var Level int = 1
var Level = 1
// SetOutput sets the output of the logger
func SetOutput(w io.Writer) {
@ -57,47 +57,76 @@ func log(level int, tag, color string, formatted bool, format string, args ...in
mu.Unlock()
}
var emptyFormat string
// Infof ...
func Infof(format string, args ...interface{}) {
log(1, "INFO", "\x1b[36m", true, format, args...)
}
// Info ...
func Info(args ...interface{}) {
log(1, "INFO", "\x1b[36m", false, "", args...)
log(1, "INFO", "\x1b[36m", false, emptyFormat, args...)
}
// HTTPf ...
func HTTPf(format string, args ...interface{}) {
log(1, "HTTP", "\x1b[1m\x1b[30m", true, format, args...)
}
// HTTP ...
func HTTP(args ...interface{}) {
log(1, "HTTP", "\x1b[1m\x1b[30m", false, "", args...)
log(1, "HTTP", "\x1b[1m\x1b[30m", false, emptyFormat, args...)
}
// Errorf ...
func Errorf(format string, args ...interface{}) {
log(1, "ERRO", "\x1b[1m\x1b[31m", true, format, args...)
}
// Error ..
func Error(args ...interface{}) {
log(1, "ERRO", "\x1b[1m\x1b[31m", false, "", args...)
log(1, "ERRO", "\x1b[1m\x1b[31m", false, emptyFormat, args...)
}
// Warnf ...
func Warnf(format string, args ...interface{}) {
log(2, "WARN", "\x1b[33m", true, format, args...)
}
// Warn ...
func Warn(args ...interface{}) {
log(2, "WARN", "\x1b[33m", false, "", args...)
log(2, "WARN", "\x1b[33m", false, emptyFormat, args...)
}
// Debugf ...
func Debugf(format string, args ...interface{}) {
log(3, "DEBU", "\x1b[35m", true, format, args...)
}
// Debug ...
func Debug(args ...interface{}) {
log(3, "DEBU", "\x1b[35m", false, "", args...)
log(3, "DEBU", "\x1b[35m", false, emptyFormat, args...)
}
// Printf ...
func Printf(format string, args ...interface{}) {
Infof(format, args...)
}
// Print ...
func Print(format string, args ...interface{}) {
Info(args...)
}
// Fatalf ...
func Fatalf(format string, args ...interface{}) {
log(1, "FATA", "x1b[31m", true, format, args...)
os.Exit(1)
}
// Fatal ...
func Fatal(args ...interface{}) {
log(1, "FATA", "\x1b[31m", false, "", args...)
log(1, "FATA", "\x1b[31m", false, emptyFormat, args...)
os.Exit(1)
}