(t *testing.T)
| 309 | } |
| 310 | |
| 311 | func TestEnvironment_Float(t *testing.T) { |
| 312 | cases := []struct { |
| 313 | put interface{} |
| 314 | get float64 |
| 315 | result chainResult |
| 316 | }{ |
| 317 | { |
| 318 | put: float32(123), |
| 319 | get: 123.0, |
| 320 | result: success, |
| 321 | }, |
| 322 | { |
| 323 | put: float64(123), |
| 324 | get: 123.0, |
| 325 | result: success, |
| 326 | }, |
| 327 | { |
| 328 | put: int(123), |
| 329 | get: 0, |
| 330 | result: failure, |
| 331 | }, |
| 332 | { |
| 333 | put: false, |
| 334 | get: 0, |
| 335 | result: failure, |
| 336 | }, |
| 337 | { |
| 338 | put: "123.0", |
| 339 | get: 0, |
| 340 | result: failure, |
| 341 | }, |
| 342 | } |
| 343 | for _, tc := range cases { |
| 344 | t.Run(fmt.Sprintf("%T-%v", tc.put, tc.put), |
| 345 | func(t *testing.T) { |
| 346 | env := newEnvironment(newMockChain(t)) |
| 347 | |
| 348 | env.Put("key", tc.put) |
| 349 | env.chain.assert(t, success) |
| 350 | |
| 351 | val := env.GetFloat("key") |
| 352 | assert.Equal(t, tc.get, val) |
| 353 | |
| 354 | env.chain.assert(t, tc.result) |
| 355 | }) |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | func TestEnvironment_String(t *testing.T) { |
| 360 | cases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…