summaryrefslogtreecommitdiffstats
path: root/parser
diff options
context:
space:
mode:
Diffstat (limited to 'parser')
-rw-r--r--parser/pageparser/item.go2
-rw-r--r--parser/pageparser/item_test.go9
2 files changed, 9 insertions, 2 deletions
diff --git a/parser/pageparser/item.go b/parser/pageparser/item.go
index 2083be70a..d4dcc2785 100644
--- a/parser/pageparser/item.go
+++ b/parser/pageparser/item.go
@@ -215,7 +215,7 @@ const (
)
var (
- boolRe = regexp.MustCompile(`^(true$)|(false$)`)
+ boolRe = regexp.MustCompile(`^(true|false)$`)
intRe = regexp.MustCompile(`^[-+]?\d+$`)
floatRe = regexp.MustCompile(`^[-+]?\d*\.\d+$`)
)
diff --git a/parser/pageparser/item_test.go b/parser/pageparser/item_test.go
index db4cc127a..72bb69103 100644
--- a/parser/pageparser/item_test.go
+++ b/parser/pageparser/item_test.go
@@ -38,6 +38,13 @@ func TestItemValTyped(t *testing.T) {
c.Assert(Item{low: 0, high: len(source)}.ValTyped(source), qt.Equals, true)
source = []byte("false")
c.Assert(Item{low: 0, high: len(source)}.ValTyped(source), qt.Equals, false)
- source = []byte("trued")
+ source = []byte("falsex")
+ c.Assert(Item{low: 0, high: len(source)}.ValTyped(source), qt.Equals, "falsex")
+ source = []byte("xfalse")
+ c.Assert(Item{low: 0, high: len(source)}.ValTyped(source), qt.Equals, "xfalse")
+ source = []byte("truex")
+ c.Assert(Item{low: 0, high: len(source)}.ValTyped(source), qt.Equals, "truex")
+ source = []byte("xtrue")
+ c.Assert(Item{low: 0, high: len(source)}.ValTyped(source), qt.Equals, "xtrue")
}