Skip to content

Commit 1dd6dae

Browse files
committed
debugui: bug fix: test failures
1 parent dde7767 commit 1dd6dae

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

debugui_test.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
func TestMultipleIDFromCallersInForLoop(t *testing.T) {
1515
var d debugui.DebugUI
16-
if err := d.Update(func(ctx *debugui.Context) error {
16+
if _, err := d.Update(func(ctx *debugui.Context) error {
1717
ctx.Window("Window", image.Rect(0, 0, 100, 100), func(layout debugui.ContainerLayout) {
1818
var id debugui.WidgetID
1919
for range 10 {
@@ -42,7 +42,7 @@ func TestMultipleIDFromCallersInForLoop(t *testing.T) {
4242

4343
func TestMultipleIDFromCallersOnOneLine(t *testing.T) {
4444
var d debugui.DebugUI
45-
if err := d.Update(func(ctx *debugui.Context) error {
45+
if _, err := d.Update(func(ctx *debugui.Context) error {
4646
ctx.Window("Window", image.Rect(0, 0, 100, 100), func(layout debugui.ContainerLayout) {
4747
idA1 := ctx.IDFromCaller()
4848
idA2 := ctx.IDFromCaller()
@@ -63,16 +63,17 @@ func TestMultipleIDFromCallersOnOneLine(t *testing.T) {
6363
func TestError(t *testing.T) {
6464
e := errors.New("test")
6565
var d debugui.DebugUI
66-
if got, want := d.Update(func(ctx *debugui.Context) error {
66+
_, err := d.Update(func(ctx *debugui.Context) error {
6767
return e
68-
}), e; got != want {
68+
})
69+
if got, want := err, e; got != want {
6970
t.Errorf("got: %v, want: %v", got, want)
7071
}
7172
}
7273

7374
func TestUpdateWithoutWindow(t *testing.T) {
7475
var d debugui.DebugUI
75-
if err := d.Update(func(ctx *debugui.Context) error {
76+
if _, err := d.Update(func(ctx *debugui.Context) error {
7677
ctx.SetGridLayout(nil, nil)
7778
return nil
7879
}); err == nil {
@@ -82,7 +83,7 @@ func TestUpdateWithoutWindow(t *testing.T) {
8283

8384
func TestUnusedContainer(t *testing.T) {
8485
var d debugui.DebugUI
85-
if err := d.Update(func(ctx *debugui.Context) error {
86+
if _, err := d.Update(func(ctx *debugui.Context) error {
8687
ctx.Window("Window1", image.Rect(0, 0, 100, 100), func(layout debugui.ContainerLayout) {
8788
})
8889
return nil
@@ -93,7 +94,7 @@ func TestUnusedContainer(t *testing.T) {
9394
t.Errorf("got: %v, want: %v", got, want)
9495
}
9596

96-
if err := d.Update(func(ctx *debugui.Context) error {
97+
if _, err := d.Update(func(ctx *debugui.Context) error {
9798
ctx.Window("Window1", image.Rect(0, 0, 100, 100), func(layout debugui.ContainerLayout) {
9899
})
99100
ctx.Window("Window2", image.Rect(0, 0, 100, 100), func(layout debugui.ContainerLayout) {
@@ -106,7 +107,7 @@ func TestUnusedContainer(t *testing.T) {
106107
t.Errorf("got: %v, want: %v", got, want)
107108
}
108109

109-
if err := d.Update(func(ctx *debugui.Context) error {
110+
if _, err := d.Update(func(ctx *debugui.Context) error {
110111
ctx.Window("Window1", image.Rect(0, 0, 100, 100), func(layout debugui.ContainerLayout) {
111112
})
112113
return nil
@@ -117,7 +118,7 @@ func TestUnusedContainer(t *testing.T) {
117118
t.Errorf("got: %v, want: %v", got, want)
118119
}
119120

120-
if err := d.Update(func(ctx *debugui.Context) error {
121+
if _, err := d.Update(func(ctx *debugui.Context) error {
121122
return nil
122123
}); err != nil {
123124
t.Fatal(err)
@@ -126,7 +127,7 @@ func TestUnusedContainer(t *testing.T) {
126127
t.Errorf("got: %v, want: %v", got, want)
127128
}
128129

129-
if err := d.Update(func(ctx *debugui.Context) error {
130+
if _, err := d.Update(func(ctx *debugui.Context) error {
130131
ctx.Window("Window2", image.Rect(0, 0, 100, 100), func(layout debugui.ContainerLayout) {
131132
})
132133
return nil

0 commit comments

Comments
 (0)