all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars-Dominik Braun <lars@6xq.net>
To: 74993@debbugs.gnu.org
Subject: [bug#74993] [PATCH] guix: toml: Fix evaluation of empty inline tables.
Date: Fri, 20 Dec 2024 12:29:32 +0100	[thread overview]
Message-ID: <a150f99f13be1d0364f961b7883278cacf2fdb53.1734694094.git.lars@6xq.net> (raw)

* 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
---
 guix/build/toml.scm | 1 +
 tests/toml.scm      | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/guix/build/toml.scm b/guix/build/toml.scm
index 81b54fa5b7..a9be0887e7 100644
--- a/guix/build/toml.scm
+++ b/guix/build/toml.scm
@@ -414,6 +414,7 @@ (define (eval-toml-file parse-tree)
                                           local-time)
                                         tails)))
       ('array (list))
+      ('inline-table '())
       (('inline-table tails ...)
        (eval (keyword-flatten '(keyval) tails) '() '()))))
 
diff --git a/tests/toml.scm b/tests/toml.scm
index cd8e4d2338..64bc667f0c 100644
--- a/tests/toml.scm
+++ b/tests/toml.scm
@@ -396,6 +396,14 @@ (define-module (test-toml)
 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]

base-commit: 946e48d1d87ec451e7a6315712f2e86c79961a51
-- 
2.45.2





                 reply	other threads:[~2024-12-20 11:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a150f99f13be1d0364f961b7883278cacf2fdb53.1734694094.git.lars@6xq.net \
    --to=lars@6xq.net \
    --cc=74993@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.