(t *testing.T)
| 753 | } |
| 754 | |
| 755 | func TestString_AsBoolean(t *testing.T) { |
| 756 | trueValues := []string{"true", "True"} |
| 757 | falseValues := []string{"false", "False"} |
| 758 | badValues := []string{"TRUE", "FALSE", "t", "f", "1", "0", "bad"} |
| 759 | |
| 760 | for _, str := range trueValues { |
| 761 | t.Run(str, func(t *testing.T) { |
| 762 | reporter := newMockReporter(t) |
| 763 | value := NewString(reporter, str) |
| 764 | |
| 765 | b := value.AsBoolean() |
| 766 | b.chain.assert(t, success) |
| 767 | |
| 768 | assert.True(t, b.Raw()) |
| 769 | }) |
| 770 | } |
| 771 | |
| 772 | for _, str := range falseValues { |
| 773 | t.Run(str, func(t *testing.T) { |
| 774 | reporter := newMockReporter(t) |
| 775 | value := NewString(reporter, str) |
| 776 | |
| 777 | b := value.AsBoolean() |
| 778 | b.chain.assert(t, success) |
| 779 | |
| 780 | assert.False(t, b.Raw()) |
| 781 | }) |
| 782 | } |
| 783 | |
| 784 | for _, str := range badValues { |
| 785 | t.Run(str, func(t *testing.T) { |
| 786 | reporter := newMockReporter(t) |
| 787 | value := NewString(reporter, str) |
| 788 | |
| 789 | b := value.AsBoolean() |
| 790 | b.chain.assert(t, failure) |
| 791 | }) |
| 792 | } |
| 793 | } |
| 794 | |
| 795 | func TestString_AsDateTime(t *testing.T) { |
| 796 | t.Run("default formats - RFC1123+GMT", func(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…