(t *testing.T)
| 434 | } |
| 435 | |
| 436 | func TestValue_GetBoolean(t *testing.T) { |
| 437 | type myBool bool |
| 438 | |
| 439 | cases := []struct { |
| 440 | name string |
| 441 | data interface{} |
| 442 | result chainResult |
| 443 | expectedBool bool |
| 444 | }{ |
| 445 | {name: "false", data: false, result: success, expectedBool: false}, |
| 446 | {name: "true", data: true, result: success, expectedBool: true}, |
| 447 | {name: "myTrue", data: myBool(true), result: success, expectedBool: true}, |
| 448 | } |
| 449 | |
| 450 | for _, tc := range cases { |
| 451 | t.Run(tc.name, func(t *testing.T) { |
| 452 | reporter := newMockReporter(t) |
| 453 | |
| 454 | value := NewValue(reporter, tc.data) |
| 455 | inner := value.Boolean() |
| 456 | |
| 457 | value.chain.assert(t, tc.result) |
| 458 | inner.chain.assert(t, tc.result) |
| 459 | |
| 460 | if tc.result { |
| 461 | assert.Equal(t, tc.expectedBool, inner.Raw()) |
| 462 | } |
| 463 | }) |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | func TestValue_IsObject(t *testing.T) { |
| 468 | cases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…