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

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

[elpa] externals/phps-mode 004f60d 3/7: Started on test for SDT


From: Christian Johansson
Subject: [elpa] externals/phps-mode 004f60d 3/7: Started on test for SDT
Date: Sun, 7 Nov 2021 14:21:36 -0500 (EST)

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

    Started on test for SDT
---
 phps-mode-test.el             |  1 -
 test/phps-mode-test-parser.el | 53 ++++++++++++++++++++++++++++++++++---------
 2 files changed, 42 insertions(+), 12 deletions(-)

diff --git a/phps-mode-test.el b/phps-mode-test.el
index b89d01d..3c0ba3d 100644
--- a/phps-mode-test.el
+++ b/phps-mode-test.el
@@ -48,7 +48,6 @@
          (incremental-buffer)
          (incremental-bookkeeping)
          (incremental-nest-location-stack)
-         (incremental)
          (test-buffer-initial (generate-new-buffer "test-initial"))
          (initial-state)
          (initial-state-stack)
diff --git a/test/phps-mode-test-parser.el b/test/phps-mode-test-parser.el
index 9ed0948..e3e8045 100644
--- a/test/phps-mode-test-parser.el
+++ b/test/phps-mode-test-parser.el
@@ -81,9 +81,9 @@
     (funcall logic)
     (message "Passed %s" name)))
 
-(defun phps-mode-test-parser-boundaries ()
-  "Run test for lexer."
-  (message "-- Running tests for parser boundaries... --\n")
+(defun phps-mode-test-parser-parse ()
+  "Run test for parser."
+  (message "-- Running tests for parser basic... --\n")
 
   (phps-mode-test-parser--buffer-contents
    "<?php echo 'hello';"
@@ -100,7 +100,7 @@
             "%d: %S -> %S"
             production-number
             (car (car production))
-            (car (car (cdr production))))))
+            (car (cdr production)))))
        (message "\n")
        (should
         (equal
@@ -153,7 +153,7 @@
             "%d: %S -> %S"
             production-number
             (car (car production))
-            (car (car (cdr production))))))
+            (car (cdr production)))))
        (message "\n")
        (should
         (equal
@@ -174,7 +174,7 @@
             "%d: %S -> %S"
             production-number
             (car (car production))
-            (car (car (cdr production))))))
+            (car (cdr production)))))
        (message "\n")
        (should
         (equal
@@ -195,7 +195,7 @@
             "%d: %S -> %S"
             production-number
             (car (car production))
-            (car (car (cdr production))))))
+            (car (cdr production)))))
        (message "\n")
        (should
         (equal
@@ -216,7 +216,7 @@
             "%d: %S -> %S"
             production-number
             (car (car production))
-            (car (car (cdr production))))))
+            (car (cdr production)))))
        (message "\n")
        (should
         (equal
@@ -237,7 +237,7 @@
             "%d: %S -> %S"
             production-number
             (car (car production))
-            (car (car (cdr production))))))
+            (car (cdr production)))))
        (message "\n")
        (should
         (equal
@@ -304,13 +304,44 @@
    (lambda()
      (phps-mode-parser-parse)))
 
-  (message "\n-- Ran tests for parser boundaries. --"))
+  (message "\n-- Ran tests for parser parse. --"))
+
+(defun phps-mode-test-parser-translate ()
+  "Run test for parse translation."
+  (message "-- Running tests for parser translation... --\n")
+
+  ;; TODO Generate bookkeeping and imenu index here
+
+  ;; (phps-mode-test-parser--buffer-contents
+  ;;  "<?php\nfunction myFunctionA() {}\nfunction myFunctionB() {}\n$var = 
function () {\n    echo 'here';\n};"
+  ;;  "Imenu function-oriented file with anonymous function"
+  ;;  (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 (cdr production))))))
+  ;;    (let ((translation (phps-mode-parser-translate)))
+  ;;      (should
+  ;;       (equal
+  ;;        (phps-mode-lex-analyzer--get-imenu)
+  ;;        '(("myFunctionA" . 16) ("myFunctionB" . 42))))
+  ;;    )))
+
+  (message "\n-- Ran tests for parser translation. --"))
 
 (defun phps-mode-test-parser ()
   "Run test for lexer."
   (message "-- Running all tests for parser... --\n")
 
-  (phps-mode-test-parser-boundaries)
+  (phps-mode-test-parser-parse)
+  (phps-mode-test-parser-translate)
 
   (message "\n-- Ran all tests for parser. --"))
 



reply via email to

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