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

Function getString

kernel_test.go:568–582  ·  view source on GitHub ↗

getString is a test helper that retrieves a value as a string from the content at the given key. If the key does not exist in the content map or the value is not a string this will fail the test. The jsonObjectName parameter is a string used to name the content for more helpful fail messages.

(t *testing.T, jsonObjectName string, content map[string]interface{}, key string)

Source from the content-addressed store, hash-verified

566// does not exist in the content map or the value is not a string this will fail the test. The jsonObjectName
567// parameter is a string used to name the content for more helpful fail messages.
568func getString(t *testing.T, jsonObjectName string, content map[string]interface{}, key string) string {
569 t.Helper()
570
571 raw, ok := content[key]
572 if !ok {
573 t.Fatalf("\t%s %s[\"%s\"] field not present", failure, jsonObjectName, key)
574 }
575
576 value, ok := raw.(string)
577 if !ok {
578 t.Fatalf("\t%s %s[\"%s\"] is not a string", failure, jsonObjectName, key)
579 }
580
581 return value
582}
583
584// getJSONObject is a test helper that retrieves a value as a map[string]interface{} from the content at the given key.
585// If the key does not exist in the content map or the value is not a map[string]interface{} this will fail the test.

Callers 4

testEvaluateFunction · 0.85
TestPanicGeneratesErrorFunction · 0.85
performJupyterRequestMethod · 0.85
testOutputStreamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected