示例#1
0
func TestParseBool(t *testing.T) {
	for _, test := range parseBoolTests {
		actual, _ := strings.ParseBool(test.input)
		if actual != test.expected {
			t.Errorf("expecting ParseBool(%v) to be %v, got %v", test.input, test.expected, actual)
		}
	}
}
示例#2
0
func (f Form) ParseBool(field string) (bool, error) {
	val := f.GetOne(field)
	return strings.ParseBool(val)
}