[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 37fd682568 07/27: Added failing unit tests fo
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 37fd682568 07/27: Added failing unit tests for PHP 8.2 |
Date: |
Sat, 4 Mar 2023 03:24:56 -0500 (EST) |
branch: externals/phps-mode
commit 37fd6825688a184df0dd39edfce174acfccfd843
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Added failing unit tests for PHP 8.2
---
test/phps-mode-test-ast.el | 2 +-
test/phps-mode-test-parser.el | 102 +++++++++++++++++++++++++++++++++++++++---
2 files changed, 97 insertions(+), 7 deletions(-)
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index e3da1b8e35..7a55cc0e7e 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -24,7 +24,7 @@
name
(lambda()
(let ((parse (phps-mode-parser-parse)))
- (message "Left-to-right with right-most derivation:\n%S\n" parse)
+ (message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
(dolist (production-number parse)
(let ((production
(phps-mode-parser--get-grammar-production-by-number
diff --git a/test/phps-mode-test-parser.el b/test/phps-mode-test-parser.el
index 2b2d998aca..b4ba6e51a1 100644
--- a/test/phps-mode-test-parser.el
+++ b/test/phps-mode-test-parser.el
@@ -69,13 +69,103 @@
"Run test for parser."
(message "-- Running tests for parser basic... --\n")
+ (phps-mode-test-parser--buffer-contents
+ "<?php\nclass Falsy\n{\n public function alwaysFalse(): false { /* ...
*/ }\n\n public function alwaysTrue(): true { /* ... */ }\n\n public
function alwaysNull(): null { /* ... */ }\n}\n"
+ "PHP 8.2 - allow null, false, and true as stand-alone types"
+ (lambda()
+
+ (let ((parse (phps-mode-parser-parse)))
+ (message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
+ (dolist (production-number 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)))))
+ (message "\n")
+ (should
+ (equal
+ '(84 198 202 443 297 330 328 327 442 446 81 443 243 91 274 262 258
280 444 140 323 444 300 302 296 330 328 327 442 446 81 443 243 91 274 262 258
280 444 140 323 444 300 302 296 330 328 327 442 446 81 443 243 91 274 262 258
280 444 140 323 444 300 302 296 185 103 108 83)
+ parse)))))
+
+ (phps-mode-test-parser--buffer-contents
+ "<?php\ntrait Foo\n{\n public const CONSTANT = 1;\n}\n\nclass Bar\n{\n
use Foo;\n}\n"
+ "PHP 8.2 - Constants in traits"
+ (lambda()
+
+ (let ((parse (phps-mode-parser-parse)))
+ (message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
+ (dolist (production-number 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)))))
+ (message "\n")
+ (should
+ (equal
+ '(84 443 297 330 328 327 81 474 426 443 343 342 299 302 296 190 104
108 83 198 202 443 297 91 459 305 307 304 296 185 103 108 83)
+ parse)))))
+
+ ;; TODO Make PHP 8.2 tests below pass
+
+ (phps-mode-test-parser--buffer-contents
+ "<?php\nclass Foo {\n public function bar((A&B)|null $entity) {\n
return $entity;\n }\n}\n"
+ "PHP 8.2 - disjunctive normal form (DNF) types"
+ (lambda()
+
+ (let ((parse (phps-mode-parser-parse)))
+ (message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
+ (dolist (production-number 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)))))
+ (message "\n")
+ (should
+ (equal
+ '(84 472 479 426 347 346 157 107 83)
+ parse)))))
+
+ (phps-mode-test-parser--buffer-contents
+ "<?php\nreadonly class BlogData\n{\n public string $title;\n\n public
Status $status;\n\n public function __construct(string $title, Status
$status)\n {\n $this->title = $title;\n $this->status =
$status;\n }\n}\n"
+ "PHP 8.2 - readonly classes"
+ (lambda()
+
+ (let ((parse (phps-mode-parser-parse)))
+ (message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
+ (dolist (production-number 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)))))
+ (message "\n")
+ (should
+ (equal
+ '(84 472 479 426 347 346 157 107 83)
+ parse)))))
+
(phps-mode-test-parser--buffer-contents
"<?php echo 'hello';"
"Basic echo test"
(lambda()
(let ((parse (phps-mode-parser-parse)))
- (message "Left-to-right with right-most derivation:\n%S\n" parse)
+ (message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
(dolist (production-number parse)
(let ((production
(phps-mode-parser--get-grammar-production-by-number
@@ -128,7 +218,7 @@
"Advanced echo test with 2 echo sections"
(lambda()
(let ((parse (phps-mode-parser-parse)))
- (message "Left-to-right with right-most derivation:\n%S\n" parse)
+ (message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
(dolist (production-number parse)
(let ((production
(phps-mode-parser--get-grammar-production-by-number
@@ -149,7 +239,7 @@
"Simple function defintion"
(lambda()
(let ((parse (phps-mode-parser-parse)))
- (message "Left-to-right with right-most derivation:\n%S\n" parse)
+ (message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
(dolist (production-number parse)
(let ((production
(phps-mode-parser--get-grammar-production-by-number
@@ -170,7 +260,7 @@
"Simple function defintion inside un-bracketed namespace"
(lambda()
(let ((parse (phps-mode-parser-parse)))
- (message "Left-to-right with right-most derivation:\n%S\n" parse)
+ (message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
(dolist (production-number parse)
(let ((production
(phps-mode-parser--get-grammar-production-by-number
@@ -191,7 +281,7 @@
"Simple function defintion inside bracketed namespace"
(lambda()
(let ((parse (phps-mode-parser-parse)))
- (message "Left-to-right with right-most derivation:\n%S\n" parse)
+ (message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
(dolist (production-number parse)
(let ((production
(phps-mode-parser--get-grammar-production-by-number
@@ -212,7 +302,7 @@
"Simple function defintion and property inside class inside non-bracketed
namespace"
(lambda()
(let ((parse (phps-mode-parser-parse)))
- (message "Left-to-right with right-most derivation:\n%S\n" parse)
+ (message "Left-to-right with right-most derivation in reverse:\n%S\n"
parse)
(dolist (production-number parse)
(let ((production
(phps-mode-parser--get-grammar-production-by-number
- [elpa] externals/phps-mode ada66dc7f3 09/27: Updated lexer for PHP 8.2, (continued)
- [elpa] externals/phps-mode ada66dc7f3 09/27: Updated lexer for PHP 8.2, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 1ac3e40e4d 13/27: Removed deletion of byte-compiled file when generating parser, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 3d1bb67d45 05/27: Removed memory limit on parser generation automation script, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 5f820bd073 02/27: Improved documentation about grammar generation, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 9fca589a4f 06/27: Updated parser to 8.2, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode ed8db6b5b7 08/27: Improved debug output, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode f4a26e193d 16/27: Updated and parser tests to 8.2, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 9b6c89191b 12/27: Fixed typo, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 9cade60362 17/27: More notes on automation, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 2c39b1af73 20/27: Updated SDT to production 350, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 37fd682568 07/27: Added failing unit tests for PHP 8.2,
Christian Johansson <=
- [elpa] externals/phps-mode 4636d702ac 10/27: Improved tests for PHP 8.2, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 54fec9e358 15/27: Removed note about error occuring, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 2a296e0947 11/27: Updated output in parser generator automation, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode ebe8fb9a36 14/27: Removed debug-on-signal in automation scripts, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 45d3898837 19/27: More work on SDT, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 27770f9abb 22/27: Parser SDT to production 500, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 4765f2c9ae 23/27: Made all parser SDT for 8.2, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode 81a9f22780 24/27: Decreased length of parser docstrings, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode fddb792453 26/27: Updated date and version for 0.4.42, Christian Johansson, 2023/03/04
- [elpa] externals/phps-mode d5a710cd12 21/27: Parser SDT to 400, Christian Johansson, 2023/03/04