utils: Make unstringify-pairs return a hash map instead of a list of pairs.

Adapt the test code accordingly.
This commit is contained in:
Sergiu Ivanov 2020-02-22 19:20:45 +01:00
parent 286a75c8ba
commit ea77374933
2 changed files with 7 additions and 5 deletions

View File

@ -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)))))

View File

@ -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))))