[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/parseclj 2da47798d9 057/185: Enable more edn.el tests, do
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/parseclj 2da47798d9 057/185: Enable more edn.el tests, document how time/uuid are stored |
Date: |
Tue, 28 Dec 2021 14:05:17 -0500 (EST) |
branch: elpa/parseclj
commit 2da47798d97fbd15cc8dcf9584d3a0511a74707f
Author: Arne Brasseur <arne@arnebrasseur.net>
Commit: Arne Brasseur <arne@arnebrasseur.net>
Enable more edn.el tests, document how time/uuid are stored
---
DESIGN.md | 5 ++-
tests/edn-el-test-suite.el | 79 +++++++++++++++++++++++-----------------------
2 files changed, 44 insertions(+), 40 deletions(-)
diff --git a/DESIGN.md b/DESIGN.md
index 064618274e..1bc710156f 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -29,6 +29,7 @@ The data structures available in Emacs are less rich than
those used by Clojure.
- Clojure has `nil` and `false`, Emacs only has `nil`.
- Emacs has no notion of sets
- Emacs has no date/timestamp type
+ - there is a `time-date.el` which has functions for working with day/time
represented as cons cells.
- Emacs has no "character" type (characters are represented as numbers)
- Emacs does not support custom records/types (there is a Common Lisp inspired
object system, but it implements types on top of regular lists and vectors).
- Emacs does not support adding metadata to values
@@ -237,7 +238,9 @@ See also the section at the top regarding differences
between Clojure's data typ
These are the choices that the edn.el library has made:
-- represent sets as `'(edn-set (... set values ...))`
+- represent sets, inst and uuid values as `cl-defstruct` objects
+ - `'(edn-set (... set values ...))`
+ - `'(edn-inst high low)` see `time-date.el`
- parse maps as hash tables
- represent characters as integers, *but* parse `\newline` `\return` `\space`
and `\tab` as the symbols `'newline` `'return` etc.
- parse `true` as `t`, `nil` and `false` as `nil`.
diff --git a/tests/edn-el-test-suite.el b/tests/edn-el-test-suite.el
index 7a2387b021..ba854a5b87 100644
--- a/tests/edn-el-test-suite.el
+++ b/tests/edn-el-test-suite.el
@@ -135,36 +135,36 @@
(puthash (pop keys-and-values) (pop keys-and-values) m))
m))
-;; (ert-deftest maps ()
-;; :tags '(edn maps)
-;; (should (hash-table-p (clj-parse-edn-str "{ }")))
-;; (should (hash-table-p (clj-parse-edn-str "{}")))
-;; (should (map-equal (make-seeded-hash-table :foo :bar :baz :qux)
-;; (clj-parse-edn-str "{ :foo :bar :baz :qux}")))
-;; (should (map-equal (make-seeded-hash-table 1 "123" 'vector [1 2 3])
-;; (clj-parse-edn-str "{ 1 \"123\" vector [1 2 3]}")))
-;; (should (map-equal (make-seeded-hash-table [1 2 3] "some numbers")
-;; (clj-parse-edn-str "{[1 2 3] \"some numbers\"}"))))
-
-;; (ert-deftest sets ()
-;; :tags '(edn sets)
-;; (should (edn-set-p (clj-parse-edn-str "#{}")))
-;; (should (edn-set-p (clj-parse-edn-str "#{ }")))
-;; (should (equal (edn-list-to-set '(1 2 3)) (clj-parse-edn-str "#{1 2 3}")))
-;; (should (equal (edn-list-to-set '(1 [1 2 3] 3)) (clj-parse-edn-str "#{1
[1 2 3] 3}"))))
-
-;; (ert-deftest comment ()
-;; :tags '(edn comments)
-;; (should-not (clj-parse-edn-str ";nada"))
-;; (should (equal 1 (clj-parse-edn-str ";; comment
-;; 1")))
-;; (should (equal [1 2 3] (clj-parse-edn-str "[1 2 ;comment to eol
-;; 3]")))
-;; (should (equal '[valid more items] (clj-parse-edn-str "[valid;touching
trailing comment
-;; more items]")))
-;; (should (equal [valid vector more vector items] (clj-parse-edn-str
"[valid vector
-;; ;;comment in vector
-;; more vector items]"))))
+(ert-deftest maps ()
+ :tags '(edn maps)
+ (should (hash-table-p (clj-parse-edn-str "{ }")))
+ (should (hash-table-p (clj-parse-edn-str "{}")))
+ (should (map-equal (make-seeded-hash-table :foo :bar :baz :qux)
+ (clj-parse-edn-str "{ :foo :bar :baz :qux}")))
+ (should (map-equal (make-seeded-hash-table 1 "123" 'vector [1 2 3])
+ (clj-parse-edn-str "{ 1 \"123\" vector [1 2 3]}")))
+ (should (map-equal (make-seeded-hash-table [1 2 3] "some numbers")
+ (clj-parse-edn-str "{[1 2 3] \"some numbers\"}"))))
+
+(ert-deftest sets ()
+ :tags '(edn sets)
+ (should (edn-set-p (clj-parse-edn-str "#{}")))
+ (should (edn-set-p (clj-parse-edn-str "#{ }")))
+ (should (equal (edn-list-to-set '(1 2 3)) (clj-parse-edn-str "#{1 2 3}")))
+ (should (equal (edn-list-to-set '(1 [1 2 3] 3)) (clj-parse-edn-str "#{1 [1 2
3] 3}"))))
+
+(ert-deftest comment ()
+ :tags '(edn comments)
+ (should-not (clj-parse-edn-str ";nada"))
+ (should (equal 1 (clj-parse-edn-str ";; comment
+1")))
+ (should (equal [1 2 3] (clj-parse-edn-str "[1 2 ;comment to eol
+3]")))
+ (should (equal '[valid more items] (clj-parse-edn-str "[valid;touching
trailing comment
+ more items]")))
+ (should (equal [valid vector more vector items] (clj-parse-edn-str "[valid
vector
+ ;;comment in vector
+ more vector items]"))))
;; (defun test-val-passed-to-handler (val)
;; (should (listp val))
@@ -181,15 +181,16 @@
;; (should (= 1 (clj-parse-edn-str "#my/type (1 2)")))
;; (should (= 2 (clj-parse-edn-str "#my/other-type {:foo :bar}"))))
-;; (ert-deftest roundtrip ()
-;; :tags '(edn roundtrip)
-;; (let ((data [1 2 3 :foo (4 5) qux "quux"]))
-;; (should (equal data (clj-parse-edn-str (edn-print-string data))))
-;; (should (map-equal (make-seeded-hash-table :foo :bar)
-;; (clj-parse-edn-str (edn-print-string
(make-seeded-hash-table :foo :bar)))))
-;; (should (equal (edn-list-to-set '(1 2 3 [3 1.11]))
-;; (clj-parse-edn-str (edn-print-string (edn-list-to-set
'(1 2 3 [3 1.11]))))))
-;; (should-error (clj-parse-edn-str "#myapp/Person {:first \"Fred\" :last
\"Mertz\"}"))))
+(ert-deftest roundtrip ()
+ :tags '(edn roundtrip)
+ (let ((data [1 2 3 :foo (4 5) qux "quux"]))
+ (should (equal data (clj-parse-edn-str (edn-print-string data))))
+ (should (map-equal (make-seeded-hash-table :foo :bar)
+ (clj-parse-edn-str (edn-print-string
(make-seeded-hash-table :foo :bar)))))
+ (should (equal (edn-list-to-set '(1 2 3 [3 1.11]))
+ (clj-parse-edn-str (edn-print-string (edn-list-to-set '(1 2
3 [3 1.11]))))))
+ ;;(should-error (clj-parse-edn-str "#myapp/Person {:first \"Fred\" :last
\"Mertz\"}"))
+ ))
;; (ert-deftest inst ()
;; :tags '(edn inst)
- [nongnu] elpa/parseclj 07739abe2c 030/185: support keywords, (continued)
- [nongnu] elpa/parseclj 07739abe2c 030/185: support keywords, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj ced0b91c08 029/185: "Support" namespaces symbols, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 1eef0b62c8 034/185: Support #_discard forms, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 0974b56833 035/185: Stick to non CL functions, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj f8822bb43c 040/185: Add support for tags in lexer, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 43f59dcb91 043/185: Avoid dropping whitespaces, handling them while reducing, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 7733985037 047/185: DESIGN.md-related adjustments, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj c906de33a1 048/185: Rewrite all tests, and add new tests for the AST "printer", ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 697618dbb1 049/185: Merge pull request #1 from volrath/master, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj e7686c49ed 052/185: Greater parity with edn.el, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 2da47798d9 057/185: Enable more edn.el tests, document how time/uuid are stored,
ELPA Syncer <=
- [nongnu] elpa/parseclj f6de87fbe6 067/185: Split EDN and AST handling in separate files, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj d410a1530e 096/185: Add code-checking defaults to `dir-locals.el`, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 3a92eafce9 079/185: Rename reduce-node to reduce-branch, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 7beff77b15 083/185: Introduce parseclj-parse-clojure, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 3d261f5d3c 072/185: Bump version of a, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 47cf208a91 091/185: Fix parsing of tags/discard with :lexical-preservation, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj da4bacb5f5 078/185: Rename parseclj-reduce to parseclj-parse, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 2a42dcb6fa 066/185: Update License info in README, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj ba9f4d723f 076/185: Document proposal for alternative package organization, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj a8e1de0d62 075/185: Merge pull request #4 from lambdaisland/edn-ast-split, ELPA Syncer, 2021/12/28