WIP on v1

This commit is contained in:
Dmitry Fedotov
2025-04-09 02:13:47 +03:00
parent 27cb532ec4
commit b88b2fd5e6
5 changed files with 317 additions and 159 deletions

View File

@@ -17,12 +17,15 @@ editor = vim
distance=13.42
floats=0.5,2.37,6
floatswithstring = 0.5, hello, 0.9
no missedme
false
color`)
func TestPackage(t *testing.T) {
r := bytes.NewReader(testConf)
c := parseReader(r)
c, err := parseReader(r)
if err != nil {
t.Fatal(err)
}
if _, err := c.Get("floatswithstring").Float64Slice(); err == nil {
t.Log("Float64Slice accepting incorrect values")
t.Fail()
@@ -99,7 +102,7 @@ func TestPackage(t *testing.T) {
t.Log("empty string erroneously converts to float")
t.Fail()
}
if def := c.GetDefault("non-existant-key", "myvalue"); def.Value != "myvalue" {
if def := c.GetDefault("non-existant-key", "myvalue"); def.String() != "myvalue" {
t.Log("GetDefault fails to apply default value")
t.Fail()
}