Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdata committed Oct 23, 2023
1 parent 7b20ab8 commit 0ebaaf9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions element_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ type testUi struct {
updateFn func(e *Element)
}

var _ UI = (*testUi)(nil)
var _ StringSetter = (*testUi)(nil)

func (tss *testUi) JawsGetString(e *Element) string {
atomic.AddInt32(&tss.getCalled, 1)
return tss.s
Expand Down
23 changes: 23 additions & 0 deletions request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,3 +595,26 @@ func TestRequest_Dirty(t *testing.T) {
}
}
}

func TestRequest_UpdatePanicLogs(t *testing.T) {
tmr := time.NewTimer(testTimeout)
defer tmr.Stop()
nextJid = 0
rq := newTestRequest()
defer rq.Close()

tss := &testUi{
updateFn: func(e *Element) {
panic("wildpanic")
}}
rq.UI(tss)
rq.Dirty(tss)
select {
case <-tmr.C:
t.Fatal("timeout")
case <-rq.doneCh:
}
if s := rq.jw.log.String(); !strings.Contains(s, "wildpanic") {
t.Error(s)
}
}

0 comments on commit 0ebaaf9

Please sign in to comment.