MCPcopy Index your code
hub / github.com/gavv/httpexpect / TestEnvironment_String

Function TestEnvironment_String

environment_test.go:359–395  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

357}
358
359func TestEnvironment_String(t *testing.T) {
360 cases := []struct {
361 put interface{}
362 get string
363 result chainResult
364 }{
365 {
366 put: "test",
367 get: "test",
368 result: success,
369 },
370 {
371 put: []byte("test"),
372 get: "",
373 result: failure,
374 },
375 {
376 put: 123,
377 get: "",
378 result: failure,
379 },
380 }
381 for _, tc := range cases {
382 t.Run(fmt.Sprintf("%T-%v", tc.put, tc.put),
383 func(t *testing.T) {
384 env := newEnvironment(newMockChain(t))
385
386 env.Put("key", tc.put)
387 env.chain.assert(t, success)
388
389 val := env.GetString("key")
390 assert.Equal(t, tc.get, val)
391
392 env.chain.assert(t, tc.result)
393 })
394 }
395}
396
397func TestEnvironment_Bytes(t *testing.T) {
398 cases := []struct {

Callers

nothing calls this directly

Calls 6

newEnvironmentFunction · 0.85
newMockChainFunction · 0.85
PutMethod · 0.80
assertMethod · 0.80
GetStringMethod · 0.80
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…