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

Function TestString_AsBoolean

string_test.go:755–793  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

753}
754
755func 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
795func TestString_AsDateTime(t *testing.T) {
796 t.Run("default formats - RFC1123+GMT", func(t *testing.T) {

Callers

nothing calls this directly

Calls 7

AsBooleanMethod · 0.95
newMockReporterFunction · 0.85
NewStringFunction · 0.85
assertMethod · 0.80
TrueMethod · 0.80
FalseMethod · 0.80
RawMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…