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

Function TestEnvironment_Float

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

Source from the content-addressed store, hash-verified

309}
310
311func 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
359func TestEnvironment_String(t *testing.T) {
360 cases := []struct {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…