(t *testing.T)
| 357 | } |
| 358 | |
| 359 | func 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 | |
| 397 | func TestEnvironment_Bytes(t *testing.T) { |
| 398 | cases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…