コード例 #1
0
ファイル: strings_test.go プロジェクト: joragues-syb/gotools
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)
}