Fix dummy return. Closes #34
This commit is contained in:
@@ -24,13 +24,13 @@ func New() safeRouteList {
|
||||
|
||||
func (srl *safeRouteList) Append(r model.Route) model.Route {
|
||||
srl.m.Lock()
|
||||
r.Index = len(srl.rs)
|
||||
srl.rs = append(srl.rs, r)
|
||||
l := len(srl.rs)
|
||||
srl.m.Unlock()
|
||||
|
||||
Server.Handler.(*mux.SwappableMux).Update(srl.Snapshot())
|
||||
|
||||
return model.Route{Index: l - 1}
|
||||
return r
|
||||
}
|
||||
|
||||
func (srl *safeRouteList) Snapshot() []model.Route {
|
||||
|
||||
@@ -147,7 +147,17 @@ func TestSnapshotNonBlockingReadWithOtherReaders(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppendReturnsTheInsertedRoutedWithTheActualIndexWhenEmpty(t *testing.T) {
|
||||
func TestAppendReturnsTheInsertedRouted(t *testing.T) {
|
||||
srl := New()
|
||||
|
||||
r := srl.Append(model.Route{ID: "FOO"})
|
||||
|
||||
if r.ID != "FOO" {
|
||||
t.Errorf(`ID of the returned route is not "FOO", but %q`, r.ID)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppendReturnsTheNumberedRoutesWhenEmpty(t *testing.T) {
|
||||
srl := New()
|
||||
|
||||
r := srl.Append(model.Route{})
|
||||
|
||||
Reference in New Issue
Block a user