Skip to content

Commit 54ff638

Browse files
committed
This massively cuts back on the elisp code needed.
1 parent 49ba0d3 commit 54ff638

File tree

4 files changed

+12
-34
lines changed

4 files changed

+12
-34
lines changed

php-mode-test.el

+5-27
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,7 @@ have a string face."
108108
(ert-deftest php-mode-test-issue-14 ()
109109
"Array indentation."
110110
:expected-result :failed
111-
(with-php-mode-test ("issue-14.php")
112-
(let ((expected (concat "$post = Post::model()->find(array(\n"
113-
" 'select' => 'title',\n"
114-
" 'condition' => 'postID=:postID',\n"
115-
" 'params' => array(':postID'=>10),\n"
116-
"));")))
117-
(indent-region (point-min) (point-max))
118-
(goto-char (point-min))
119-
(re-search-forward "^\\$post")
120-
(should (string= (buffer-substring-no-properties (match-beginning 0) (point-max))
121-
expected)))))
111+
(with-php-mode-test ("issue-14.php" :indent t :magic t)))
122112

123113
(ert-deftest php-mode-test-issue-16 ()
124114
"Comma separated \"use\" (namespaces).
@@ -136,9 +126,7 @@ Gets the face of the text after the comma."
136126
(ert-deftest php-mode-test-issue-19 ()
137127
"Alignment of arrow operators."
138128
:expected-result :failed
139-
(with-php-mode-test ("issue-19.php")
140-
(indent-region (point-min) (point-max))
141-
(goto-char (point-min))
129+
(with-php-mode-test ("issue-19.php" :indent t)
142130
(while (re-search-forward "^\\s-*\\$object->")
143131
;; Point is just after `->'
144132
(let ((col (current-column)))
@@ -166,11 +154,7 @@ This applies for both single and double quotes."
166154

167155
(ert-deftest php-mode-test-issue-27 ()
168156
"Indentation in a file with a shebang."
169-
(with-php-mode-test ("issue-27.php")
170-
(re-search-forward "^\\s-*// Tab")
171-
(indent-for-tab-command)
172-
(back-to-indentation)
173-
(should (eq (current-column) tab-width))))
157+
(with-php-mode-test ("issue-27.php" :indent t :magic t)))
174158

175159
(ert-deftest php-mode-test-issue-28 ()
176160
"Slowdown when scrolling.
@@ -186,16 +170,10 @@ This doesn't test anything, for now."
186170
(ert-deftest php-mode-test-issue-29 ()
187171
"Indentation of anonymous functions as arguments.
188172
The closing brace and parenthesis should be at column 0."
189-
(with-php-mode-test ("issue-29.php")
190-
(indent-region (point-min) (point-max))
191-
(goto-char (point-min))
192-
(re-search-forward "^\\s-*});")
193-
(back-to-indentation)
194-
(should (eq (current-column) 0))))
173+
(with-php-mode-test ("issue-29.php" :indent t :magic t)))
195174

196175
(ert-deftest php-mode-test-issue-42 ()
197176
"Error while indenting closures.
198177
If the bug has been fixed, indenting the buffer should not cause
199178
an error."
200-
(with-php-mode-test ("issue-42.php")
201-
(indent-region (point-min) (point-max))))
179+
(with-php-mode-test ("issue-42.php" :indent t)))

tests/issue-14.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
$post = Post::model()->find(array(
18-
'select' => 'title',
19-
'condition' => 'postID=:postID',
20-
'params' => array(':postID'=>10),
21-
));
18+
'select' => 'title', // ###php-mode-test### ((indent c-basic-offset))
19+
'condition' => 'postID=:postID', // ###php-mode-test### ((indent c-basic-offset))
20+
'params' => array(':postID'=>10), // ###php-mode-test### ((indent c-basic-offset))
21+
)); // ###php-mode-test### ((indent 0))

tests/issue-27.php

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
*/
1313

1414
if (1 == 1) {
15-
// Tab
15+
// Tab ###php-mode-test### ((indent c-basic-offset))
1616
}

tests/issue-29.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
*/
1313

1414
$app->get("/index", function() {
15-
$app->redirect("foo");
16-
});
15+
$app->redirect("foo"); // ###php-mode-test### ((indent c-basic-offset))
16+
}); // ###php-mode-test### ((indent 0))

0 commit comments

Comments
 (0)