[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 1ab6ac7324 131/212: Added failing tests for i
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 1ab6ac7324 131/212: Added failing tests for indentation |
Date: |
Wed, 26 Jan 2022 01:51:12 -0500 (EST) |
branch: externals/phps-mode
commit 1ab6ac7324199423db5f86424eb2707e5fc07a7d
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Added failing tests for indentation
---
test/phps-mode-test-indent.el | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/test/phps-mode-test-indent.el b/test/phps-mode-test-indent.el
index fc2d2ce036..c1c2510cfc 100644
--- a/test/phps-mode-test-indent.el
+++ b/test/phps-mode-test-indent.el
@@ -20,7 +20,7 @@
(defun phps-mode-test-indent--indent-whole-buffer ()
"Use alternative indentation of every line of buffer."
(goto-char (point-min))
- (phps-mode-indent-line)
+ (indent-for-tab-command)
(while (search-forward "\n" nil t nil)
;; Go to random point on line
(let ((line-min-position (line-beginning-position))
@@ -29,7 +29,7 @@
(+
line-min-position
(random (- line-max-position line-min-position)))))
- (phps-mode-indent-line)))
+ (indent-for-tab-command)))
(defun phps-mode-test-indent--should-equal (string name)
"Test indent of whole buffer containing STRING with NAME."
@@ -244,6 +244,34 @@
"$var = myFunction(\n 'setting');\necho 'here';\n"
"Multi-line assignment from function ending without opening bracket")
+ (phps-mode-test-indent--should-equal
+ "<?php\n\nclass MyClass\n{\n function myFunction()\n {\n
return 'Text'\n . 'here';\n }\n}\n"
+ "Multi-line return statement of concatenated string")
+
+ (phps-mode-test-indent--should-equal
+ "<?php\n\nclass MyClass\n{\n function myFunction()\n {\n
return aFunction(\n 'values');\n }\n}\n"
+ "Multi-line return expression ending at line with starting close bracket")
+
+ (phps-mode-test-indent--should-equal
+ "<?php\n$packageItems[] = [\n 'customs_value' =>\n
$orderItem->getPrice(),\n 'name' =>\n $orderItem->getName(),\n
'order_item_id' =>\n $orderItem->getItemId(),\n 'price' =>\n
$orderItem->getPrice(),\n 'product_id' =>\n
$orderItem->getProductId(),\n 'qty' =>\n
$orderItem->getQtyToShip(),\n 'weight' =>\n
$orderItem->getRowWeight(),\n];"
+ "Assignment of square bracket array with element values from object
methods")
+
+ (phps-mode-test-indent--should-equal
+ "<?php\n$productId1 = $this->generateProduct([\n 'country_of_origin'
=>\n 'SE',\n 'hs_code' =>\n '0000 1234 5679 0000',\n 'name'
=>\n 'Simple Product # 1',\n 'price' =>\n 7,\n 'weight'
=>\n 1.2,\n]);\n"
+ "Assignment from object method values with square bracket argument on
multiple lines")
+
+ (phps-mode-test-indent--should-equal
+ "<?php\nforeach ($order->getAllItems() as $orderItem) {\n // Check if
order item has qty to ship or is virtual\n if (\n
!$orderItem->getQtyToShip()\n || $orderItem->getIsVirtual()\n ) {\n
continue;\n }\n}"
+ "Multi-line if expression checking object method values")
+
+ (phps-mode-test-indent--should-equal
+ "<?php\nif (true) {\n throw new Exception(\n sprintf(\n
self::systemTranslate(\n 'Invalid parameters for Application.
Parameters: \"%s\".'\n ),\n print_r(self::$_parameters,
true)\n )\n );\n}\n"
+ "Throwing exception on multiple lines using sprintf")
+
+ (phps-mode-test-indent--should-equal
+ "<?php\n\nif (false) {\n if (true) {\n $conversion =
myFunction(\n $weight,\n $weightUnit,\n
$toWeightUnit\n );\n }\n}"
+ "Nested multi-line assignment from function call")
+
)
(defun phps-mode-test-indent--get-lines-indent-psr-2 ()
- [elpa] externals/phps-mode 7a636ccd28 078/212: Removed obsolete file parser-grammar-macro.el, (continued)
- [elpa] externals/phps-mode 7a636ccd28 078/212: Removed obsolete file parser-grammar-macro.el, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode ee211dac6a 084/212: Started on indentation tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f65ca852cd 092/212: Passed another indent test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 9a2573939a 094/212: More wrestling, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 7c0cb57312 098/212: Added more multi-line assignment indent tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 3a594466d5 100/212: Passed indent test for multi-line assignments, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 7deebc5f79 101/212: Improved indent test descriptions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d5d80017bc 104/212: Passed indent tests for concatenated string, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e083e90ac0 108/212: Passing more indentation tests for PSR-2, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 84d447e4e6 119/212: Added TODO item, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 1ab6ac7324 131/212: Added failing tests for indentation,
Christian Johansson <=
- [elpa] externals/phps-mode 7135a30446 173/212: Updated TODO items, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 63c5fef240 175/212: Started on tests for more basic functions of indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 735f1e0c89 176/212: More notes, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 73d460d5a4 181/212: Passing lexer tests with optimized lexer, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e5df43eea9 187/212: More tweaking of indentation helpers, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 413547fbf1 188/212: Searching for previous bracket now steps over optional PHP starting tags, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4b4a96fda2 208/212: Improved cache filename, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode ef97058a67 184/212: Added more tests for indentation helper functions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a1af5b11fb 040/212: More work on bookkeeping of class properties via AST, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4dc07c9041 050/212: Bookkeeping via AST working with assigned variables from array, Christian Johansson, 2022/01/26