Remove all Context.Global* methods

and change the behavior of the non-Global variants to always search up the
context lineage.

Closes #385
This commit is contained in:
Dan Buch
2016-05-16 10:18:15 -04:00
parent cab5c58774
commit bef835d455
6 changed files with 161 additions and 285 deletions

View File

@@ -1,13 +1,23 @@
package altsrc
import (
"os"
"reflect"
"runtime"
"strings"
"testing"
)
var (
wd, _ = os.Getwd()
)
func expect(t *testing.T, a interface{}, b interface{}) {
if !reflect.DeepEqual(b, a) {
t.Errorf("Expected %#v (type %v) - Got %#v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a))
_, fn, line, _ := runtime.Caller(1)
fn = strings.Replace(fn, wd+"/", "", -1)
if !reflect.DeepEqual(a, b) {
t.Errorf("(%s:%d) Expected %v (type %v) - Got %v (type %v)", fn, line, b, reflect.TypeOf(b), a, reflect.TypeOf(a))
}
}