emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/tomelr f37841cc78 25/84: test: Add test for TOML Array


From: ELPA Syncer
Subject: [elpa] externals/tomelr f37841cc78 25/84: test: Add test for TOML Array of Arrays
Date: Tue, 3 May 2022 09:58:09 -0400 (EDT)

branch: externals/tomelr
commit f37841cc781ce322ba31806cf9ef1ca7578f5714
Author: Kaushal Modi <kaushal.modi@gmail.com>
Commit: Kaushal Modi <kaushal.modi@gmail.com>

    test: Add test for TOML Array of Arrays
---
 README.org     | 17 ++++++++++++-----
 test/tarray.el | 13 ++++++++++++-
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/README.org b/README.org
index 937d0c9462..607ad24589 100644
--- a/README.org
+++ b/README.org
@@ -18,7 +18,7 @@ the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/j
 
 It will then be gradually refactored so that it meets the
 specification defined below.
-* Library Completion Status [3/7]
+* Library Completion Status [4/7]
 - [X] Scalar
   - [X] Boolean
   - [X] Integer
@@ -28,7 +28,7 @@ specification defined below.
   - [X] Date + Time with Offset
 - [X] Nil
 - [X] Arrays
-- [ ] Array of Arrays
+- [X] Array of Arrays
 - [ ] Tables
 - [ ] Array of Tables
 - [ ] Property Lists
@@ -337,16 +337,23 @@ numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
   ]
 }
 #+end_example
-*** Array of Arrays
+*** DONE Array of Arrays
+CLOSED: [2022-04-29 Fri 00:34]
 **** S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref array-of-arrays
 '((nested_arrays_of_ints . [(1 2) (3 4 5)])
   (nested_mixed_array . [(1 2) ("a" "b" "c")]))
 #+end_src
 **** TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <<array-of-arrays>>)
+#+end_src
+
+#+RESULTS:
 #+begin_src toml
-nested_arrays_of_ints = [ [ 1, 2 ], [3, 4, 5] ]
-nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ]
+nested_arrays_of_ints = [ [ 1, 2 ], [ 3, 4, 5 ] ]
+nested_mixed_array = [ [ 1, 2 ], [ "a", "b", "c" ] ]
 #+end_src
 **** JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
diff --git a/test/tarray.el b/test/tarray.el
index 1c92e55c8c..604855613a 100644
--- a/test/tarray.el
+++ b/test/tarray.el
@@ -24,7 +24,7 @@
 ;;; Code:
 (require 'tomelr)
 
-;;;; Key with array value
+;;;; Simple arrays
 (ert-deftest test-array ()
   (let ((inp '(((integers . (1 2 3)))
                ((integers2 . [1 2 3]))    ;Same as above
@@ -39,5 +39,16 @@
       (push (tomelr-encode el) out))
     (should (equal ref (nreverse out)))))
 
+;;;; Array of arrays
+(ert-deftest test-array-of-arrays ()
+  (let ((inp '(((nested_arrays_of_ints . [(1 2) (3 4 5)]))
+               ((nested_mixed_array . [(1 2) ("a" "b" "c")]))))
+        (ref '("nested_arrays_of_ints = [ [ 1, 2 ], [ 3, 4, 5 ] ]"
+               "nested_mixed_array = [ [ 1, 2 ], [ \"a\", \"b\", \"c\" ] ]"))
+        out)
+    (dolist (el inp)
+      (push (tomelr-encode el) out))
+    (should (equal ref (nreverse out)))))
+
 
 (provide 'tarray)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]