From ea773749338a3cd74647cd4580ac46086d7af4c2 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Sat, 22 Feb 2020 19:20:45 +0100 Subject: [PATCH] utils: Make unstringify-pairs return a hash map instead of a list of pairs. Adapt the test code accordingly. --- utils-tests.rkt | 10 ++++++---- utils.rkt | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/utils-tests.rkt b/utils-tests.rkt index 30894dd..2bc3839 100644 --- a/utils-tests.rkt +++ b/utils-tests.rkt @@ -50,7 +50,9 @@ '(("a" "(and a b)") ("b" "(or b (not a))"))) (check-equal? (unstringify-pairs '(("a" . "1") ("b" . "(and a (not b))"))) '((a . 1) (b . (and a (not b))))) - (check-equal? (read-org-variable-mapping "((\"a\" \"(and a b)\") (\"b\" \"(or b (not a))\"))") - '((a and a b) (b or b (not a)))) - (check-equal? (read-org-variable-mapping "((\"a\" . \"(and a b)\") (\"b\" . \"(or b (not a))\"))") - '((a and a b) (b or b (not a))))) + (let ([m1 (read-org-variable-mapping "((\"a\" \"(and a b)\") (\"b\" \"(or b (not a))\"))")] + [m2 (read-org-variable-mapping "((\"a\" . \"(and a b)\") (\"b\" . \"(or b (not a))\"))")]) + (check-equal? (hash-ref m1 'a) '(and a b)) + (check-equal? (hash-ref m2 'a) '(and a b)) + (check-equal? (hash-ref m1 'b) '(or b (not a))) + (check-equal? (hash-ref m2 'b) '(or b (not a))))) diff --git a/utils.rkt b/utils.rkt index e32b6bc..a346926 100644 --- a/utils.rkt +++ b/utils.rkt @@ -196,4 +196,4 @@ ;;; Reads a variable mapping from a string, such as the one which ;;; Org-mode produces from tables. (define (read-org-variable-mapping str) - (unstringify-pairs (read-org-table str))) + (make-hash (unstringify-pairs (read-org-table str))))