MCPcopy Index your code
hub / github.com/1Password/for-open-source / TestParseBool

Function TestParseBool

script/validator_test.go:92–114  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestParseBool(t *testing.T) {
93 testCases := []struct {
94 input string
95 expectedPass bool
96 expectedValue bool
97 expectedError string
98 }{
99 {"true", true, true, ""},
100 {"false", true, false, ""},
101 {"not a bool", false, false, "could not be parsed into a boolean"},
102 }
103
104 for _, tc := range testCases {
105 pass, value, _ := ParseBool(tc.input)
106 if pass != tc.expectedPass {
107 t.Errorf("ParseBool(%s) passing is %v, expected %v", tc.input, pass, tc.expectedPass)
108 }
109
110 if value != tc.expectedValue {
111 t.Errorf("ParseBool(%s) got new value %v, expected %v", tc.input, value, tc.expectedValue)
112 }
113 }
114}
115
116func TestIsPresent(t *testing.T) {
117 testCases := []validationTestCase{

Callers

nothing calls this directly

Calls 1

ParseBoolFunction · 0.85

Tested by

no test coverage detected