bool values are case-insensitive
diff --git a/bool.go b/bool.go
index e92e3c6..50832ac 100644
--- a/bool.go
+++ b/bool.go
@@ -2,6 +2,7 @@
import (
"fmt"
+ "strings"
)
type gbool bool
@@ -11,7 +12,7 @@
"false": false, "no": false, "off": false, "0": false}
func (b *gbool) UnmarshalText(text []byte) error {
- s := string(text)
+ s := strings.ToLower(string(text))
v, ok := gboolValues[s]
if !ok {
return fmt.Errorf("failed to parse %#q as bool", s)
diff --git a/read_test.go b/read_test.go
index c72962d..92a281b 100644
--- a/read_test.go
+++ b/read_test.go
@@ -205,10 +205,12 @@
{"[section]\nbool=yes", &cBool{cBoolS1{true}}, true},
{"[section]\nbool=on", &cBool{cBoolS1{true}}, true},
{"[section]\nbool=1", &cBool{cBoolS1{true}}, true},
+ {"[section]\nbool=tRuE", &cBool{cBoolS1{true}}, true},
{"[section]\nbool=false", &cBool{cBoolS1{false}}, true},
{"[section]\nbool=no", &cBool{cBoolS1{false}}, true},
{"[section]\nbool=off", &cBool{cBoolS1{false}}, true},
{"[section]\nbool=0", &cBool{cBoolS1{false}}, true},
+ {"[section]\nbool=NO", &cBool{cBoolS1{false}}, true},
// implicit value (true)
{"[section]\nbool", &cBool{cBoolS1{true}}, true},
// bool parse errors