emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/pacmacs da5576a321 008/472: Add UTs. Close #6


From: ELPA Syncer
Subject: [nongnu] elpa/pacmacs da5576a321 008/472: Add UTs. Close #6
Date: Thu, 6 Jan 2022 21:59:00 -0500 (EST)

branch: elpa/pacmacs
commit da5576a3216c115c234c2c21c93e1df9d26a7195
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>

    Add UTs. Close #6
---
 Cask                | 10 ++++++++++
 pacman-anim.el      | 19 ------------------
 pacman-resources.el |  9 ---------
 pacman.el           | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 65 insertions(+), 30 deletions(-)

diff --git a/Cask b/Cask
new file mode 100644
index 0000000000..d6f80229e4
--- /dev/null
+++ b/Cask
@@ -0,0 +1,10 @@
+(source gnu)
+(source melpa)
+
+(package-file "pacman.el")
+
+(files ".el")
+
+(development
+ (depends-on "el-mock")
+ (depends-on "ert-runner"))
diff --git a/pacman-anim.el b/pacman-anim.el
deleted file mode 100644
index ca73ef3901..0000000000
--- a/pacman-anim.el
+++ /dev/null
@@ -1,19 +0,0 @@
-
-(defun pacman-anim-get-frame (anim)
-  (let ((frames (plist-get anim :frames))
-        (current-frame (plist-get anim :current-frame)))
-    (nth current-frame frames)))
-
-(defun pacman-anim-next-frame (anim)
-  (let* ((frames (plist-get anim :frames))
-         (current-frame (plist-get anim :current-frame))
-         (new-current-frame (mod (+ current-frame 1)
-                                 (length frames))))
-    (plist-put anim :current-frame new-current-frame)))
-
-(defun pacman-anim-object-next-frame (anim-object)
-  (let ((anim (plist-get anim-object :animation)))
-    (plist-put anim-object :animation
-               (pacman-anim-next-frame anim))))
-
-(provide 'pacman-anim)
diff --git a/pacman-resources.el b/pacman-resources.el
deleted file mode 100644
index fa8ab4e0f1..0000000000
--- a/pacman-resources.el
+++ /dev/null
@@ -1,9 +0,0 @@
-
-(defun pacman-load-resource (filename)
-  (create-image (concat default-directory filename)
-                'png nil :heuristic-mask t))
-
-(defun pacman-insert-image (resource resource-vector)
-  (insert-image resource " " nil resource-vector))
-
-(provide 'pacman-resources)
diff --git a/pacman.el b/pacman.el
index 3dd08c2ae9..39df9f3128 100644
--- a/pacman.el
+++ b/pacman.el
@@ -1,5 +1,31 @@
-(require 'pacman-resources)
-(require 'pacman-anim)
+;;; pacman.el --- Pacman for Emacs
+
+;; Copyright (C) 2014 Codingteam
+
+;; Author: Codingteam <codingteam@conference.jabber.ru>
+;; Maintainer: Alexey Kutepov <reximkut@gmail.com>
+;; URL: http://github.com/rexim/pacman.el
+;; Version: 0.0.1
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
 
 (defconst pacman-buffer-name "*Pacman*")
 
@@ -18,6 +44,10 @@
                                            '(40 0 20 20))
                              :current-frame 0)))
 
+(defun pacman-load-resource (filename)
+  (create-image (concat default-directory filename)
+                'png nil :heuristic-mask t))
+
 (defvar pacman-resource (pacman-load-resource "pacman10-hp-sprite.png"))
 
 (define-derived-mode pacman-mode special-mode "pacman-mode"
@@ -28,6 +58,27 @@
   (define-key pacman-mode-map (kbd "q") 'pacman-quit)
   (add-hook 'kill-buffer-hook 'pacman-destroy nil t))
 
+(defun pacman-insert-image (resource resource-vector)
+  (insert-image resource " " nil resource-vector))
+
+;;;###autoload
+(defun pacman-anim-get-frame (anim)
+  (let ((frames (plist-get anim :frames))
+        (current-frame (plist-get anim :current-frame)))
+    (nth current-frame frames)))
+
+(defun pacman-anim-next-frame (anim)
+  (let* ((frames (plist-get anim :frames))
+         (current-frame (plist-get anim :current-frame))
+         (new-current-frame (mod (+ current-frame 1)
+                                 (length frames))))
+    (plist-put anim :current-frame new-current-frame)))
+
+(defun pacman-anim-object-next-frame (anim-object)
+  (let ((anim (plist-get anim-object :animation)))
+    (plist-put anim-object :animation
+               (pacman-anim-next-frame anim))))
+
 (defun pacman-start ()
   (interactive)
   (switch-to-buffer-other-window pacman-buffer-name)
@@ -82,3 +133,5 @@
   )
 
 (provide 'pacman)
+
+;;; pacman.el ends here



reply via email to

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