MCPcopy Index your code
hub / github.com/gopherdata/gophernotes / TestPanicGeneratesError

Function TestPanicGeneratesError

kernel_test.go:196–219  ·  view source on GitHub ↗

TestPanicGeneratesError tests that executing code with an un-recovered panic properly generates both an error "execute_reply" and publishes an "error" message.

(t *testing.T)

Source from the content-addressed store, hash-verified

194// TestPanicGeneratesError tests that executing code with an un-recovered panic properly generates both
195// an error "execute_reply" and publishes an "error" message.
196func TestPanicGeneratesError(t *testing.T) {
197 client, closeClient := newTestJupyterClient(t)
198 defer closeClient()
199
200 content, pub := client.executeCode(t, `panic("error")`)
201
202 status := getString(t, "content", content, "status")
203
204 if status != "error" {
205 t.Fatalf("\t%s Execution did not raise expected error", failure)
206 }
207
208 var foundPublishedError bool
209 for _, pubMsg := range pub {
210 if pubMsg.Header.MsgType == "error" {
211 foundPublishedError = true
212 break
213 }
214 }
215
216 if !foundPublishedError {
217 t.Fatalf("\t%s Execution did not publish an expected \"error\" message", failure)
218 }
219}
220
221// TestPrintStdout tests that data written to stdout publishes the same data in a "stdout" "stream" message.
222func TestPrintStdout(t *testing.T) {

Callers

nothing calls this directly

Calls 3

newTestJupyterClientFunction · 0.85
getStringFunction · 0.85
executeCodeMethod · 0.80

Tested by

no test coverage detected