This commit is contained in:
Jeff (Zhefu) Jiang 2015-07-20 13:44:03 -07:00
Родитель 2991a9d6d9
Коммит ae04743ced
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -49,16 +49,16 @@ func Tests(t *testing.T, im *qrpb.VTGateCallerID, ef *vtpb.CallerID) {
// Test GetXxx on nil receivers, should get all empty strings
if u := GetUsername(ctxim); u != "" {
t.Errorf("Expect empty string from (nil).GetUsername(), but got %v", u)
t.Errorf("Expect empty string from GetUsername(nil), but got %v", u)
}
if p := GetPrincipal(ctxef); p != "" {
t.Errorf("Expect empty string from (nil).GetPrincipal(), but got %v", p)
t.Errorf("Expect empty string from GetPrincipal(nil), but got %v", p)
}
if c := GetComponent(ctxef); c != "" {
t.Errorf("Expect empty string from (nil).GetComponent(), but got %v", c)
t.Errorf("Expect empty string from GetComponent(nil), but got %v", c)
}
if s := GetSubcomponent(ctxef); s != "" {
t.Errorf("Expect empty string from (nil).GetSubcomponent(), but got %v", s)
t.Errorf("Expect empty string from GetSubcomponent(nil), but got %v", s)
}
ctx = NewContext(ctx, ef, im)
@ -68,7 +68,7 @@ func Tests(t *testing.T, im *qrpb.VTGateCallerID, ef *vtpb.CallerID) {
t.Errorf("Expect %v from ImmediateCallerIDFromContext, but got %v", im, ctxim)
}
if u := GetUsername(im); u != FakeUsername {
t.Errorf("Expect %v from im.Username(), but got %v", FakeUsername, u)
t.Errorf("Expect %v from GetUsername(im), but got %v", FakeUsername, u)
}
ctxef = EffectiveCallerIDFromContext(ctx)
@ -77,12 +77,12 @@ func Tests(t *testing.T, im *qrpb.VTGateCallerID, ef *vtpb.CallerID) {
t.Errorf("Expect %v from EffectiveCallerIDFromContext, but got %v", ef, ctxef)
}
if p := GetPrincipal(ef); p != FakePrincipal {
t.Errorf("Expect %v from ef.Principal(), but got %v", FakePrincipal, p)
t.Errorf("Expect %v from GetPrincipal(ef), but got %v", FakePrincipal, p)
}
if c := GetComponent(ef); c != FakeComponent {
t.Errorf("Expect %v from ef.Component(), but got %v", FakeComponent, c)
t.Errorf("Expect %v from GetComponent(ef), but got %v", FakeComponent, c)
}
if s := GetSubcomponent(ef); s != FakeSubcomponent {
t.Errorf("Expect %v from ef.Subcomponent(), but got %v", FakeSubcomponent, s)
t.Errorf("Expect %v from GetSubcomponent(ef), but got %v", FakeSubcomponent, s)
}
}