mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (warnings; formatting)
GitOrigin-RevId: 1083dff9db4677ea04bcb6b380f6933715e29d8d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5d278c55a9
commit
f0dcbe74ae
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 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.
|
||||
package com.intellij.testFramework;
|
||||
|
||||
import com.intellij.lang.TokenWrapper;
|
||||
@@ -24,7 +10,6 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.testFramework.fixtures.IdeaTestExecutionPolicy;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -37,15 +22,15 @@ import java.util.List;
|
||||
* @author peter
|
||||
*/
|
||||
public abstract class LexerTestCase extends UsefulTestCase {
|
||||
protected void doTest(@NonNls String text) {
|
||||
protected void doTest(String text) {
|
||||
doTest(text, null);
|
||||
}
|
||||
|
||||
protected void doTest(@NonNls String text, @Nullable String expected) {
|
||||
protected void doTest(String text, @Nullable String expected) {
|
||||
doTest(text, expected, createLexer());
|
||||
}
|
||||
|
||||
protected void doTest(@NonNls String text, @Nullable String expected, @NotNull Lexer lexer) {
|
||||
protected void doTest(String text, @Nullable String expected, @NotNull Lexer lexer) {
|
||||
String result = printTokens(text, 0, lexer);
|
||||
|
||||
if (expected != null) {
|
||||
@@ -178,12 +163,12 @@ public abstract class LexerTestCase extends UsefulTestCase {
|
||||
return tokenType + " ('" + getTokenText(tokenType, fileText, start, end) + "')\n";
|
||||
}
|
||||
|
||||
protected void doFileTest(@NonNls String fileExt) {
|
||||
protected void doFileTest(String fileExt) {
|
||||
doTest(loadTestDataFile("." + fileExt));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected String loadTestDataFile(@NonNls String fileExt) {
|
||||
protected String loadTestDataFile(String fileExt) {
|
||||
String fileName = getPathToTestDataFile(fileExt);
|
||||
String text = "";
|
||||
try {
|
||||
@@ -202,11 +187,9 @@ public abstract class LexerTestCase extends UsefulTestCase {
|
||||
|
||||
@NotNull
|
||||
private static String getTokenText(IElementType tokenType, CharSequence sequence, int start, int end) {
|
||||
if (tokenType instanceof TokenWrapper) {
|
||||
return ((TokenWrapper)tokenType).getValue();
|
||||
}
|
||||
|
||||
return StringUtil.replace(sequence.subSequence(start, end).toString(), "\n", "\\n");
|
||||
return tokenType instanceof TokenWrapper
|
||||
? ((TokenWrapper)tokenType).getValue()
|
||||
: StringUtil.replace(sequence.subSequence(start, end).toString(), "\n", "\\n");
|
||||
}
|
||||
|
||||
protected abstract Lexer createLexer();
|
||||
|
||||
Reference in New Issue
Block a user