mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
df85cb9ae2
commit
00fe7e0408
2 changed files with 9 additions and 2 deletions
|
@ -215,7 +215,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
boolRe = regexp.MustCompile(`^(true$)|(false$)`)
|
boolRe = regexp.MustCompile(`^(true|false)$`)
|
||||||
intRe = regexp.MustCompile(`^[-+]?\d+$`)
|
intRe = regexp.MustCompile(`^[-+]?\d+$`)
|
||||||
floatRe = regexp.MustCompile(`^[-+]?\d*\.\d+$`)
|
floatRe = regexp.MustCompile(`^[-+]?\d*\.\d+$`)
|
||||||
)
|
)
|
||||||
|
|
|
@ -38,6 +38,13 @@ func TestItemValTyped(t *testing.T) {
|
||||||
c.Assert(Item{low: 0, high: len(source)}.ValTyped(source), qt.Equals, true)
|
c.Assert(Item{low: 0, high: len(source)}.ValTyped(source), qt.Equals, true)
|
||||||
source = []byte("false")
|
source = []byte("false")
|
||||||
c.Assert(Item{low: 0, high: len(source)}.ValTyped(source), qt.Equals, 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")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue