File indexing completed on 2024-04-28 15:52:52

0001 /*
0002     SPDX-FileCopyrightText: 2006 Hamish Rodda <rodda@kde.org>
0003     SPDX-FileCopyrightText: 2008 Niko Sams <niko.sams@gmail.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 #ifndef LEXERTEST_H
0009 #define LEXERTEST_H
0010 
0011 #include <QObject>
0012 #include <QByteArray>
0013 #include <QTest>
0014 
0015 #include "phplexer.h"
0016 
0017 namespace KDevelop
0018 {
0019 class TopDUContext;
0020 }
0021 
0022 namespace Php
0023 {
0024 class TokenStream;
0025 class LexerTest : public QObject
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     LexerTest();
0031 
0032 private slots:
0033     void testOpenTagWithNewline();
0034     void testOpenTagWithSpace();
0035     void testCommentOneLine();
0036     void testCommentOneLine2();
0037     void testCommentMultiLine();
0038     void testCommentMultiLine2();
0039     void testEndTag();
0040     void testNewlineInString();
0041     void testNewlineInString2();
0042     void testNewlineInStringWithVar();
0043     void testNewlineInStringWithVar2();
0044     void testNewlineInStringWithVar3();
0045     void testMultiplePhpSections();
0046     void testHereDoc();
0047     void testHereDocQuoted();
0048     void testNowdoc();
0049     void testCommonStringTokens();
0050     void testNonTerminatedStringWithVar();
0051     void testPhpBlockWithComment();
0052     void testNamespaces();
0053     void testCloseTagInComment();
0054     void testBinaryNumber();
0055     void testHexadecimalNumber();
0056     void testTypeHintsOnFunction();
0057     void testReturnTypeHints();
0058     void testExponentiation();
0059     void testExceptionFinally();
0060     void testEllipsis();
0061     void testSpaceship();
0062     void testNullCoalesce();
0063 
0064 protected:
0065     TokenStream* tokenize(const QString& unit, bool debug = false, int initialState = Lexer::HtmlState);
0066 };
0067 
0068 }
0069 
0070 #endif // LEXERTEST_H