From fdc1bf659d9834fce6c78d31680b580eab3f4235 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 10 Jul 2013 16:54:17 +0200 Subject: records: Add `recutils->alist' for public consumption. * guix/records.scm (%recutils-field-rx): New variable. (recutils->alist): New procedure, formerly known as `fields->alist'. * guix/scripts/substitute-binary.scm (fields->alist): Use it. * tests/records.scm ("recutils->alist"): New test. --- tests/records.scm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests') diff --git a/tests/records.scm b/tests/records.scm index 9e524b670c..470644451c 100644 --- a/tests/records.scm +++ b/tests/records.scm @@ -131,6 +131,23 @@ (parameterize ((mark (cons 'a 'b))) (eq? (foo-baz y) (mark)))))))) +(test-equal "recutils->alist" + '((("Name" . "foo") + ("Version" . "0.1") + ("Synopsis" . "foo bar") + ("Something_else" . "chbouib")) + (("Name" . "bar") + ("Version" . "1.5"))) + (let ((p (open-input-string "Name: foo +Version: 0.1 +Synopsis: foo bar +Something_else: chbouib + +Name: bar +Version: 1.5"))) + (list (recutils->alist p) + (recutils->alist p)))) + (test-end) -- cgit v1.2.3