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

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

[nongnu] elpa/pacmacs 0839611f42 108/472: Refactor out pacmacs--make-boa


From: ELPA Syncer
Subject: [nongnu] elpa/pacmacs 0839611f42 108/472: Refactor out pacmacs--make-board function (#74)
Date: Thu, 6 Jan 2022 21:59:17 -0500 (EST)

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

    Refactor out pacmacs--make-board function (#74)
---
 pacmacs-board.el                                   | 43 ++++++++++++++++++++++
 pacmacs.el                                         | 11 ++----
 test/{pacman-anim-test.el => pacmacs-anim-test.el} |  0
 test/pacmacs-board-test.el                         |  9 +++++
 ...{pacman-image-test.el => pacmacs-image-test.el} |  0
 test/pacmacs-test.el                               | 11 ------
 ...{pacman-utils-test.el => pacmacs-utils-test.el} |  0
 7 files changed, 55 insertions(+), 19 deletions(-)

diff --git a/pacmacs-board.el b/pacmacs-board.el
new file mode 100644
index 0000000000..ad876c5a83
--- /dev/null
+++ b/pacmacs-board.el
@@ -0,0 +1,43 @@
+;;; pacmacs-board.el --- Pacman for Emacs
+
+;; Copyright (C) 2015 Codingteam
+
+;; Author: Codingteam <codingteam@conference.jabber.ru>
+;; Maintainer: Alexey Kutepov <reximkut@gmail.com>
+;; URL: http://github.com/rexim/pacmacs.el
+
+;; 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.
+
+;;; Commentary:
+
+;; Routines for working with board
+
+;;; Code:
+
+(defun pacmacs--make-board (width height)
+  (let ((board (make-vector height nil)))
+    (dotimes (row height)
+      (aset board row (make-vector width nil)))
+    board))
+
+(provide 'pacmacs-board)
+
+;;; pacmacs-board.el ends here
diff --git a/pacmacs.el b/pacmacs.el
index 3d21f5447e..be7ca5b149 100644
--- a/pacmacs.el
+++ b/pacmacs.el
@@ -38,6 +38,7 @@
 (require 'dash)
 
 (require 'pacmacs-anim)
+(require 'pacmacs-board)
 (require 'pacmacs-image)
 (require 'pacmacs-utils)
 
@@ -133,12 +134,6 @@
         :speed 0
         :speed-counter 0))
 
-(defun pacmacs--init-board (width height)
-  (let ((board (make-vector height nil)))
-    (dotimes (row height)
-      (aset board row (make-vector width nil)))
-    board))
-
 (defun pacmacs--kill-buffer-and-its-window (buffer-or-name)
   (let ((buffer-window (get-buffer-window buffer-or-name)))
     (if (and buffer-window
@@ -390,9 +385,9 @@
     (setq pacmacs-board-width board-width)
     (setq pacmacs-board-height board-height)
 
-    (setq pacmacs-board (pacmacs--init-board pacmacs-board-width
+    (setq pacmacs-board (pacmacs--make-board pacmacs-board-width
                                              pacmacs-board-height))
-    (setq pacmacs-track-board (pacmacs--init-board pacmacs-board-width
+    (setq pacmacs-track-board (pacmacs--make-board pacmacs-board-width
                                                    pacmacs-board-height))
 
     (setq pacmacs-wall-cells nil)
diff --git a/test/pacman-anim-test.el b/test/pacmacs-anim-test.el
similarity index 100%
rename from test/pacman-anim-test.el
rename to test/pacmacs-anim-test.el
diff --git a/test/pacmacs-board-test.el b/test/pacmacs-board-test.el
new file mode 100644
index 0000000000..b390281829
--- /dev/null
+++ b/test/pacmacs-board-test.el
@@ -0,0 +1,9 @@
+(ert-deftest pacmacs--make-board-test ()
+  (let ((width 5)
+        (height 4)
+        (expected-board [[nil nil nil nil nil]
+                         [nil nil nil nil nil]
+                         [nil nil nil nil nil]
+                         [nil nil nil nil nil]]))
+    (should (equal expected-board
+                   (pacmacs--make-board width height)))))
diff --git a/test/pacman-image-test.el b/test/pacmacs-image-test.el
similarity index 100%
rename from test/pacman-image-test.el
rename to test/pacmacs-image-test.el
diff --git a/test/pacmacs-test.el b/test/pacmacs-test.el
index 4e02b4299f..8859859408 100644
--- a/test/pacmacs-test.el
+++ b/test/pacmacs-test.el
@@ -8,17 +8,6 @@
     (should (equal expected-board
                    input-board))))
 
-
-(ert-deftest pacmacs--init-board-test ()
-  (let ((width 5)
-        (height 4)
-        (expected-board [[nil nil nil nil nil]
-                         [nil nil nil nil nil]
-                         [nil nil nil nil nil]
-                         [nil nil nil nil nil]]))
-    (should (equal expected-board
-                   (pacmacs--init-board width height)))))
-
 (ert-deftest pacmacs--object-at-p-test ()
   (let ((pacmacs-board-width 5)
         (pacmacs-board-height 4)
diff --git a/test/pacman-utils-test.el b/test/pacmacs-utils-test.el
similarity index 100%
rename from test/pacman-utils-test.el
rename to test/pacmacs-utils-test.el



reply via email to

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