Don't allow floats starting with a dot

This commit is contained in:
Thomas Pelletier
2013-12-10 17:17:15 +01:00
parent c743c90315
commit 278c4d97ec
3 changed files with 21 additions and 0 deletions
+12
View File
@@ -210,6 +210,18 @@ func TestEmptyIntermediateTable(t *testing.T) {
}
}
func TestFloatsWithoutLeadingZeros(t *testing.T) {
_, err := Load("a = .42")
if err.Error() != "cannot start float with a dot" {
t.Error("Bad error message:", err.Error())
}
_, err = Load("a = -.42")
if err.Error() != "cannot start float with a dot" {
t.Error("Bad error message:", err.Error())
}
}
func TestMissingFile(t *testing.T) {
_, err := LoadFile("foo.toml")
if err.Error() != "open foo.toml: no such file or directory" {