[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/record 457791b 04/13: Test cases.
From: |
Lars Brinkhoff |
Subject: |
[Emacs-diffs] scratch/record 457791b 04/13: Test cases. |
Date: |
Mon, 20 Mar 2017 16:11:08 -0400 (EDT) |
branch: scratch/record
commit 457791b1222ff5323df12b8afdae35bd111824e1
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 dbb4691), Lars Brinkhoff, 2017/03/20
- [Emacs-diffs] scratch/record 457791b 04/13: Test cases.,
Lars Brinkhoff <=
- [Emacs-diffs] scratch/record 29d7fef 03/13: Make EIEIO use records., Lars Brinkhoff, 2017/03/20
- [Emacs-diffs] scratch/record fff19c5 06/13: Use sizeof to get length of cl-struct prefix., Lars Brinkhoff, 2017/03/20
- [Emacs-diffs] scratch/record 6450a4c 07/13: Better doc string for `old-struct-compat'., Lars Brinkhoff, 2017/03/20
- [Emacs-diffs] scratch/record 953ceab 10/13: Fix cl-print-object to find the object class the new way., Lars Brinkhoff, 2017/03/20
- [Emacs-diffs] scratch/record 18e3aac 01/13: Add record objects with user-defined types., Lars Brinkhoff, 2017/03/20
- [Emacs-diffs] scratch/record f6e4882 11/13: Make a note that CHECK_RECORD_TYPE is a work in progress., Lars Brinkhoff, 2017/03/20
- [Emacs-diffs] scratch/record 9122e24 12/13: Signal errors from APIs., Lars Brinkhoff, 2017/03/20
- [Emacs-diffs] scratch/record be8079b 05/13: Backward compatibility with pre-existing struct instances., Lars Brinkhoff, 2017/03/20
- [Emacs-diffs] scratch/record 91584a7 09/13: Make it possible to compare records with `equal'., Lars Brinkhoff, 2017/03/20
- [Emacs-diffs] scratch/record dbb4691 13/13: Enable legacy defstruct compatibility., Lars Brinkhoff, 2017/03/20