emacs-diffs
[Top][All Lists]
Advanced

[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]



reply via email to

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