~ruther/guix-local

2e3d4f16d4add7abb3cc7195b058b0b3ab8df3da — Lars-Dominik Braun 1 year, 4 months ago e3a69f3
guix: toml: Fix evaluation of empty inline tables.

* guix/build/toml.scm (eval-toml-file): Add pattern for empty inline table.
* tests/toml.scm ("parse-toml: Empty inline table"): New testcase.

Change-Id: I69663af2a861716acfb801fad4474e029e102a1b
2 files changed, 9 insertions(+), 0 deletions(-)

M guix/build/toml.scm
M tests/toml.scm
M guix/build/toml.scm => guix/build/toml.scm +1 -0
@@ 414,6 414,7 @@ the list KEY. For instance a KEY (a b) would retrieve alist[a][b]."
                                          local-time)
                                        tails)))
      ('array (list))
      ('inline-table '())
      (('inline-table tails ...)
       (eval (keyword-flatten '(keyval) tails) '() '()))))


M tests/toml.scm => tests/toml.scm +8 -0
@@ 396,6 396,14 @@ fruit.apple.taste.sweet = true"))
point = { x = 1, y = 2 }
animal = { type.name = \"pug\" }"))

(test-equal "parse-toml: Empty inline table"
 '(("name")
   ("point")
   ("animal"))
 (parse-toml "name = {}
point = { }
animal = {    }"))

(test-error "parse-toml: Invalid assignment to inline table"
 #t
 (parse-toml "[product]