[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/record 9ed24e2 2/4: Test cases.
From: |
Lars Brinkhoff |
Subject: |
[Emacs-diffs] scratch/record 9ed24e2 2/4: Test cases. |
Date: |
Wed, 15 Mar 2017 17:49:17 -0400 (EDT) |
branch: scratch/record
commit 9ed24e29c8b7850bd0f6f487fc0f008cead70a85
Author: Lars Brinkhoff <address@hidden>
Commit: Lars Brinkhoff <address@hidden>
Test cases.
---
test.el | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/test.el b/test.el
new file mode 100644
index 0000000..388395f
--- /dev/null
+++ b/test.el
@@ -0,0 +1,54 @@
+(require 'eieio)
+
+(let ((x (make-record 'foo 3 nil)))
+ (aset x 1 1)
+ (aset x 2 2)
+ (aset x 3 3)
+ (list (read-from-string (with-output-to-string (prin1 x)))
+ (recordp x)
+ (type-of x)
+ (aref x 0)
+ (aref x 3)
+ (length x)))
+
+
+(cl-defstruct foo x y z)
+(let ((x (make-foo :y 1)))
+ (list (type-of x)
+ (foo-p x)
+ (recordp x)
+ (foo-y x)
+ x))
+
+(progn
+ (cl-defstruct bar1 x)
+ (make-bar1 :x 0)) ;[cl-struct-bar1 0]
+
+(progn
+ (cl-defstruct (bar2 :named) x)
+ (make-bar2 :x 0)) ;[cl-struct-bar2 0]
+
+(progn
+ (cl-defstruct (bar3 (:type list)) x)
+ (make-bar3 :x 0)) ;(0)
+
+(progn
+ (cl-defstruct (bar4 (:type list) :named) x)
+ (make-bar4 :x 0)) ;(bar4 0)
+
+(progn
+ (cl-defstruct (bar5 (:type vector)) x)
+ (make-bar5 :x 0)) ;[0]
+
+(progn
+ (cl-defstruct (bar6 (:type vector) :named) x)
+ (make-bar6 :x 0)) ;[bar6 0]
+
+(progn
+ (cl-defstruct (bar7 (:type record)) x)
+ (make-bar7 :x 0)) ;%[bar7 0]
+
+
+(progn
+ (cl-defstruct (bar8 (:type record) :named) x)
+ (make-bar8 :x 0)) ;%[bar8 0]