mirror of https://github.com/perkeep/perkeep.git
all: fix misc bugs found with go test ./...
Change-Id: If5bda860c9cc6bdc14c2977646516c58d17d62de
This commit is contained in:
parent
91ea14c63e
commit
0888d28260
|
@ -145,14 +145,14 @@ func checkOrigin() {
|
|||
func setPushOrigin() {
|
||||
out, err := exec.Command("git", "remote", "set-url", "--push", "origin", newOrigin).CombinedOutput()
|
||||
if err != nil {
|
||||
log.Fatal("%v, %s", err, out)
|
||||
log.Fatalf("%v, %s", err, out)
|
||||
}
|
||||
}
|
||||
|
||||
func setFetchOrigin() {
|
||||
out, err := exec.Command("git", "remote", "set-url", "origin", newOrigin).CombinedOutput()
|
||||
if err != nil {
|
||||
log.Fatal("%v, %s", err, out)
|
||||
log.Fatalf("%v, %s", err, out)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -524,7 +524,7 @@ func (c *Client) SetHaveCache(cache HaveCache) {
|
|||
|
||||
func (c *Client) printf(format string, v ...interface{}) {
|
||||
if c.Verbose && c.Logger != nil {
|
||||
c.Logger.Printf(format, v)
|
||||
c.Logger.Printf(format, v...)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
Copyright 2017 The Perkeep Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package geo
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestWrapAntimeridian(t *testing.T) {
|
||||
tt := []struct {
|
||||
east, newEast, west, newWest float64
|
||||
}{
|
||||
{
|
||||
// Should wrap around +180
|
||||
east: -160.,
|
||||
west: 50.,
|
||||
newEast: 200.,
|
||||
newWest: 50.,
|
||||
},
|
||||
{
|
||||
// Should wrap around -180
|
||||
east: -10.,
|
||||
west: 150.,
|
||||
newEast: -10.,
|
||||
newWest: -210.,
|
||||
},
|
||||
{
|
||||
// Should do nothing
|
||||
east: 40.,
|
||||
west: -60.,
|
||||
newEast: 40.,
|
||||
newWest: -60.,
|
||||
},
|
||||
}
|
||||
|
||||
for k, v := range tt {
|
||||
eastWest := WrapAntimeridian(v.east, v.west)
|
||||
if v.newEast != eastWest.E || v.newWest != eastWest.W {
|
||||
t.Errorf("at test %d, got [%v, %v], wanted [%v, %v]", k, v.newEast, v.newWest, eastWest.E, eastWest.W)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue