Skip to content

Commit c25e7dd

Browse files
authored
Merge pull request #17 from stevenremot/public-api
Improve the public API for plugins
2 parents 141de10 + 36331eb commit c25e7dd

File tree

5 files changed

+98
-7
lines changed

5 files changed

+98
-7
lines changed

Cask

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66

77
(development
88
(depends-on "ecukes")
9+
(depends-on "ert-runner")
910
(depends-on "f"))

Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@ CASK=cask
22

33
.PHONY: test test-simple elc package clean
44

5-
test-simple:
5+
test-unit:
6+
$(CASK) exec ert-runner
7+
8+
test-functional:
69
$(CASK) exec ecukes
710

11+
test-all:
12+
$(MAKE) test-unit
13+
$(MAKE) test-functional
14+
815
test:
916
$(MAKE) clean
10-
$(MAKE) test-simple
17+
$(MAKE) test-all
1118
$(MAKE) elc
12-
$(MAKE) test-simple
19+
$(MAKE) test-all
1320

1421
elc:
1522
$(CASK) build

ede-php-autoload-composer.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;;; ede-php-autoload-composer.el --- Composer projects detection and analysis -*- lexical-binding: t -*-
22

3-
;; Copyright (C) 2015, Steven Rémot
3+
;; Copyright (C) 2015, 2017, Steven Rémot
44

55
;; Author: Steven Rémot <[email protected]>
66
;; Keywords: PHP project ede
@@ -164,7 +164,7 @@ NEW-AUTOLOADS will be merged into BASE-AUTOLOADS. BASE-AUTOLOADS will be mutate
164164

165165
autoloads))
166166

167-
(defun ede-php-autoload--merge-composer-autoloads (composer-data autoloads &optional base-dir)
167+
(defun ede-php-autoload-composer-merge-composer-autoloads (composer-data autoloads &optional base-dir)
168168
"Load the autoload information in COMPOSER-DATA and merge it with AUTOLOADS.
169169
170170
COMPOSER-DATA is the parsed composer.json file.
@@ -249,7 +249,7 @@ Returns the new list of autoloads."
249249
250250
CONTEXT is the composer context.
251251
AUTOLOADS is the current list of autoloads."
252-
(ede-php-autoload--merge-composer-autoloads (ede-php-autoload-composer-get-composer-data context) autoloads nil))
252+
(ede-php-autoload-composer-merge-composer-autoloads (ede-php-autoload-composer-get-composer-data context) autoloads nil))
253253

254254
(ede-php-autoload-composer-define-visitor #'ede-php-autoload-composer--merge-composer-data-autoloads)
255255

@@ -267,7 +267,7 @@ AUTOLOADS is the current list of autoloads."
267267
current-data)
268268
(while (< i l)
269269
(setq current-data (aref third-party-data i)
270-
autoloads (ede-php-autoload--merge-composer-autoloads
270+
autoloads (ede-php-autoload-composer-merge-composer-autoloads
271271
current-data
272272
autoloads
273273
(ede-php-autoload-composer--get-third-party-dir current-data vendor-dir))
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
;;; ede-php-autoload-composer-test.el --- Unit test for ede-php-autoload-composer
2+
3+
;;; Commentary:
4+
;;
5+
;; Copyright (C) 2017, Steven Rémot
6+
7+
;; Author: Steven Rémot <[email protected]>
8+
;; Keywords: PHP project ede
9+
;; Homepage: https://github.com/stevenremot/ede-php-autoload
10+
11+
;; This file is not part of GNU Emacs.
12+
13+
;; This program is free software; you can redistribute it and/or
14+
;; modify it under the terms of the GNU General Public License as
15+
;; published by the Free Software Foundation; either version 2, or (at
16+
;; your option) any later version.
17+
18+
;; This program is distributed in the hope that it will be useful, but
19+
;; WITHOUT ANY WARRANTY; without even the implied warranty of
20+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21+
;; General Public License for more details.
22+
23+
;; You should have received a copy of the GNU General Public License
24+
;; along with this program; see the file COPYING. If not, write to
25+
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26+
;; Boston, MA 02111-1307, USA.
27+
28+
;;; Code:
29+
30+
(ert-deftest ede-php-autoload-composer-merge-autoloads-concats-files ()
31+
"`ede-php-autoload-composer-merge-autoloads' should concat provided autoloads."
32+
(should (equal
33+
34+
(ede-php-autoload-composer-merge-autoloads
35+
'(:psr-0 (("Test" . "test/")) :psr-4 (("Test3" . "test3/")))
36+
'(:psr-0 (("Test2" . "test2/")) :psr-4 (("Test4" . "test4/"))))
37+
38+
'(:psr-0 (("Test" . "test/")
39+
("Test2" . "test2/"))
40+
:psr-4 (("Test3" . "test3/")
41+
("Test4" . "test4/"))))))
42+
43+
(provide 'ede-php-autoload-composer-test)
44+
45+
;;; ede-php-autoload-composer-test.el ends here

test/test-helper.el

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
;;; test-helper.el --- Unit test bootstrap
2+
3+
;;; Commentary:
4+
;;
5+
;; Copyright (C) 2017, Steven Rémot
6+
7+
;; Author: Steven Rémot <[email protected]>
8+
;; Keywords: PHP project ede
9+
;; Homepage: https://github.com/stevenremot/ede-php-autoload
10+
11+
;; This file is not part of GNU Emacs.
12+
13+
;; This program is free software; you can redistribute it and/or
14+
;; modify it under the terms of the GNU General Public License as
15+
;; published by the Free Software Foundation; either version 2, or (at
16+
;; your option) any later version.
17+
18+
;; This program is distributed in the hope that it will be useful, but
19+
;; WITHOUT ANY WARRANTY; without even the implied warranty of
20+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21+
;; General Public License for more details.
22+
23+
;; You should have received a copy of the GNU General Public License
24+
;; along with this program; see the file COPYING. If not, write to
25+
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26+
;; Boston, MA 02111-1307, USA.
27+
28+
;;; Code:
29+
30+
(add-to-list 'load-path (concat (file-name-directory (or load-file-name buffer-file-name)) "/.."))
31+
(message (concat (or load-file-name buffer-file-name) "/.."))
32+
33+
(require 'ert)
34+
(require 'ede-php-autoload)
35+
36+
(provide 'test-helper)
37+
38+
;;; test-helper.el ends here

0 commit comments

Comments
 (0)