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

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

[elpa] externals/phps-mode 37dda7a 34/96: Added another failing test for


From: Christian Johansson
Subject: [elpa] externals/phps-mode 37dda7a 34/96: Added another failing test for parser
Date: Fri, 29 Oct 2021 11:14:41 -0400 (EDT)

branch: externals/phps-mode
commit 37dda7a92ecd90ffaa8661dc881e59245e560e7a
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    Added another failing test for parser
---
 test/phps-mode-test-parser.el | 32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)

diff --git a/test/phps-mode-test-parser.el b/test/phps-mode-test-parser.el
index fa0bab3..d5baa5e 100644
--- a/test/phps-mode-test-parser.el
+++ b/test/phps-mode-test-parser.el
@@ -187,12 +187,34 @@
          '(80 77 81 108 79 137 427 431 428 176 178 428 247 241 238 120 236 266 
429 137 502 492 498 461 411 345 156 138 136 502 492 498 342 481 151 138 136 429 
175 98 139 136 142 102 79)
          parse)))))
 
+  ;; TODO Make this test pass
+  (phps-mode-test-parser--buffer-contents
+   "<?php\nnamespace myNamespace;\nclass MyClass\n{\n    private $var = 
'abc';\n    public function myFunction($arg) {\n        $arg = 2;\n        
return $arg;\n    }\n}\n"
+   "Simple function defintion and property inside class inside non-bracketed 
namespace"
+   (lambda()
+     (let ((parse (phps-mode-parser-parse)))
+       (message "Left-to-right with left-most derivation:\n%S\n" parse)
+       (dolist (production-number (reverse parse))
+         (let ((production
+                (phps-mode-parser--get-grammar-production-by-number
+                 production-number)))
+           (message
+            "%d: %S -> %S"
+            production-number
+            (car (car production))
+            (car (car (cdr production))))))
+       (message "\n")
+       (should
+        (equal
+         '(80 77 81 108 79 137 427 431 428 176 178 428 247 241 238 120 236 266 
429 137 502 492 498 461 411 345 156 138 136 502 492 498 342 481 151 138 136 429 
175 98 139 136 142 102 79)
+         parse)))))
+
   ;; TODO Make following test work
-  ;; (phps-mode-test-parser--buffer-contents
-  ;;  "<?php\n\nnamespace myNamespaceA {\n    $var = 123;\n    class myClassA 
{\n        private $var2 = 123;\n        function myFunctionA($var3) {\n        
    $var4 = 123;\n            if ($var) {\n                echo 'Miss';\n       
     }\n            if ($var2) {\n                echo 'Miss';\n            }\n 
           if ($var3) {\n                echo 'Hit';\n            }\n           
 if ($var4) {\n                echo 'Hit';\n            }\n        }\n\n        
function myFun [...]
-  ;;  "Object oriented PHP with bracket namespace"
-  ;;  (lambda()
-  ;;    (phps-mode-parser-parse)))
+  (phps-mode-test-parser--buffer-contents
+   "<?php\n\nnamespace myNamespaceA {\n    $var = 123;\n    class myClassA {\n 
       private $var2 = 123;\n        function myFunctionA($var3) {\n            
$var4 = 123;\n            if ($var) {\n                echo 'Miss';\n           
 }\n            if ($var2) {\n                echo 'Miss';\n            }\n     
       if ($var3) {\n                echo 'Hit';\n            }\n            if 
($var4) {\n                echo 'Hit';\n            }\n        }\n\n        
function myFuncti [...]
+   "Object oriented PHP with bracket namespace"
+   (lambda()
+     (phps-mode-parser-parse)))
 
   (message "\n-- Ran tests for parser boundaries. --"))
 



reply via email to

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