mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: put expression parsing test data in separate files (IDEA-321503)
GitOrigin-RevId: 9367abdf70adab0a4d0e8d0b3570a7f9a99c3267
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9c2b546f0a
commit
155fabab65
@@ -0,0 +1 @@
|
||||
STR.""
|
||||
@@ -0,0 +1 @@
|
||||
STR."\{}"
|
||||
@@ -0,0 +1 @@
|
||||
STR."\{ 1 }"
|
||||
@@ -0,0 +1 @@
|
||||
STR."\{ (1) } \{ "!" }"
|
||||
@@ -0,0 +1,2 @@
|
||||
STR."\{ """
|
||||
!""" }"
|
||||
@@ -0,0 +1 @@
|
||||
"\{}"
|
||||
@@ -0,0 +1 @@
|
||||
STR."\{}".length()
|
||||
@@ -0,0 +1 @@
|
||||
STR."\{
|
||||
@@ -0,0 +1,2 @@
|
||||
STR."""
|
||||
"""
|
||||
@@ -0,0 +1,2 @@
|
||||
STR."""
|
||||
\{}"""
|
||||
@@ -0,0 +1,2 @@
|
||||
STR."""
|
||||
\{ 1 }"""
|
||||
@@ -0,0 +1,2 @@
|
||||
STR."""
|
||||
\{ (1) } \{ "!" }"""
|
||||
@@ -0,0 +1,3 @@
|
||||
STR."""
|
||||
\{ """
|
||||
!""" }"""
|
||||
@@ -0,0 +1,2 @@
|
||||
"""
|
||||
\{}"""
|
||||
@@ -0,0 +1,2 @@
|
||||
STR."""
|
||||
\{}""".length()
|
||||
@@ -0,0 +1 @@
|
||||
STR."""\{
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.parser;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -62,6 +62,16 @@ public abstract class JavaParsingTestCase extends ParsingTestCase {
|
||||
myLanguageLevel = languageLevel;
|
||||
}
|
||||
|
||||
protected void doParserTest(Consumer<PsiBuilder> parser) {
|
||||
String name = getTestName(false);
|
||||
try {
|
||||
doParserTest(loadFile(name + "." + myFileExt), parser);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void doParserTest(String text, Consumer<PsiBuilder> parser) {
|
||||
String name = getTestName(false);
|
||||
myFile = createPsiFile(name, text, parser);
|
||||
|
||||
+20
-16
@@ -162,24 +162,28 @@ public class ExpressionParserTest extends JavaParsingTestCase {
|
||||
public void testYieldAsExpr2() { doParserTest("yield += 2"); }
|
||||
public void testYieldAsExpr3() { doParserTest("yield ? 10 : 20"); }
|
||||
|
||||
public void testStringTemplate1() { doParserTest("STR.\"\""); }
|
||||
public void testStringTemplate2() { doParserTest("STR.\"\\{}\""); }
|
||||
public void testStringTemplate3() { doParserTest("STR.\"\\{ 1 }\""); }
|
||||
public void testStringTemplate4() { doParserTest("STR.\"\\{ (1) } \\{ \"!\" }\""); }
|
||||
public void testStringTemplate5() { doParserTest("STR.\"\\{ \"\"\"\n!\"\"\" }\""); }
|
||||
public void testStringTemplate6() { doParserTest("\"\\{}\""); }
|
||||
public void testStringTemplate7() { doParserTest("STR.\"\\{}\".length()"); }
|
||||
public void testStringTemplate8() { doParserTest("STR.\"\\{"); }
|
||||
public void testTextBlockTemplate1() { doParserTest("STR.\"\"\"\n\"\"\""); }
|
||||
public void testTextBlockTemplate2() { doParserTest("STR.\"\"\"\n\\{}\"\"\""); }
|
||||
public void testTextBlockTemplate3() { doParserTest("STR.\"\"\"\n\\{ 1 }\"\"\""); }
|
||||
public void testTextBlockTemplate4() { doParserTest("STR.\"\"\"\n\\{ (1) } \\{ \"!\" }\"\"\""); }
|
||||
public void testTextBlockTemplate5() { doParserTest("STR.\"\"\"\n\\{ \"\"\"\n!\"\"\" }\"\"\""); }
|
||||
public void testTextBlockTemplate6() { doParserTest("\"\"\"\n\\{}\"\"\""); }
|
||||
public void testTextBlockTemplate7() { doParserTest("STR.\"\"\"\n\\{}\"\"\".length()"); }
|
||||
public void testTextBlockTemplate8() { doParserTest("STR.\"\"\"\\{"); }
|
||||
public void testStringTemplate1() { doParserTest(); }
|
||||
public void testStringTemplate2() { doParserTest(); }
|
||||
public void testStringTemplate3() { doParserTest(); }
|
||||
public void testStringTemplate4() { doParserTest(); }
|
||||
public void testStringTemplate5() { doParserTest(); }
|
||||
public void testStringTemplate6() { doParserTest(); }
|
||||
public void testStringTemplate7() { doParserTest(); }
|
||||
public void testStringTemplate8() { doParserTest(); }
|
||||
public void testTextBlockTemplate1() { doParserTest(); }
|
||||
public void testTextBlockTemplate2() { doParserTest(); }
|
||||
public void testTextBlockTemplate3() { doParserTest(); }
|
||||
public void testTextBlockTemplate4() { doParserTest(); }
|
||||
public void testTextBlockTemplate5() { doParserTest(); }
|
||||
public void testTextBlockTemplate6() { doParserTest(); }
|
||||
public void testTextBlockTemplate7() { doParserTest(); }
|
||||
public void testTextBlockTemplate8() { doParserTest(); }
|
||||
|
||||
private void doParserTest(String text) {
|
||||
doParserTest(text, builder -> JavaParser.INSTANCE.getExpressionParser().parse(builder));
|
||||
}
|
||||
|
||||
private void doParserTest() {
|
||||
doParserTest(builder -> JavaParser.INSTANCE.getExpressionParser().parse(builder));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user