[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/record 050463b 04/10: Test cases.
From: |
Lars Brinkhoff |
Subject: |
[Emacs-diffs] scratch/record 050463b 04/10: Test cases. |
Date: |
Sun, 19 Mar 2017 05:34:12 -0400 (EDT) |
branch: scratch/record
commit 050463bbc2a5f9f5e34b1a47422abb854be8dbbf
Author: Lars Brinkhoff <address@hidden>
Commit: Lars Brinkhoff <address@hidden>
Test cases.
The .elc was compiled with Emacs built from master.
---
old-struct.el | 14 ++++++++++++++
old-struct.elc | Bin 0 -> 2971 bytes
test.el | 45 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 59 insertions(+)
diff --git a/old-struct.el b/old-struct.el
new file mode 100644
index 0000000..5f38801
--- /dev/null
+++ b/old-struct.el
@@ -0,0 +1,14 @@
+(require 'cl-macs)
+
+(cl-defstruct old x)
+
+(defun foo ()
+ (make-old))
+
+;;(byte-compile-file "old-struct.el")
+;;(load-file "old-struct.elc")
+;;(disassemble 'foo)
+;;(cl-typep (foo) 'cl-structure-object)
+;;(cl-struct-p (foo))
+;;(memq (aref (foo) 0) cl-struct-cl-structure-object-tags)
+;;(setq old-struct-compat t)
diff --git a/old-struct.elc b/old-struct.elc
new file mode 100644
index 0000000..49b1765
Binary files /dev/null and b/old-struct.elc differ
diff --git a/test.el b/test.el
new file mode 100644
index 0000000..c46dd08
--- /dev/null
+++ b/test.el
@@ -0,0 +1,45 @@
+(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)) ;#%[bar1 0]
+
+(progn
+ (cl-defstruct (bar2 :named) x)
+ (make-bar2 :x 0)) ;#%[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]
- [Emacs-diffs] branch scratch/record created (now 5369952), Lars Brinkhoff, 2017/03/19
- [Emacs-diffs] scratch/record 050463b 04/10: Test cases.,
Lars Brinkhoff <=
- [Emacs-diffs] scratch/record 7f9b0eb 06/10: Use sizeof to get length of cl-struct prefix., Lars Brinkhoff, 2017/03/19
- [Emacs-diffs] scratch/record f89ce93 09/10: Make it possible to compare records with `equal'., Lars Brinkhoff, 2017/03/19
- [Emacs-diffs] scratch/record b1d61ca 02/10: Update cl-defstruct to use records., Lars Brinkhoff, 2017/03/19
- [Emacs-diffs] scratch/record 97215ed 07/10: Better doc string for `old-struct-compat'., Lars Brinkhoff, 2017/03/19
- [Emacs-diffs] scratch/record 4c92cb0 03/10: Make EIEIO use records., Lars Brinkhoff, 2017/03/19
- [Emacs-diffs] scratch/record 5369952 10/10: Fix cl-print-object to find the object class the new way., Lars Brinkhoff, 2017/03/19
- [Emacs-diffs] scratch/record 7dfaded 01/10: Add record objects with user-defined types., Lars Brinkhoff, 2017/03/19
- [Emacs-diffs] scratch/record 7f51870 08/10: Better doc strings for `make-record', `record', and `copy-record'., Lars Brinkhoff, 2017/03/19
- [Emacs-diffs] scratch/record 0eaf0e6 05/10: Backward compatibility with pre-existing struct instances., Lars Brinkhoff, 2017/03/19