[Groovy] convert GroovySpellcheckerTest to Java (IDEA-327339)

GitOrigin-RevId: 6c351674397a61362a600f627a2797f1d5f8d0fc
This commit is contained in:
Aleksey Dobrynin
2024-10-17 21:10:52 +00:00
committed by intellij-monorepo-bot
parent 8a7a1d1b9c
commit 82dd6c9f6a
@@ -1,56 +1,40 @@
/*
* 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.
*/
package org.jetbrains.plugins.groovy.lang
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.groovy.lang;
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import com.intellij.spellchecker.inspections.SpellCheckingInspection
import com.intellij.spellchecker.inspections.SpellCheckingInspection;
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
class GroovySpellcheckerTest extends LightJavaCodeInsightFixtureTestCase {
void testParameterName() {
myFixture.configureByText 'a.groovy', '''
def test(int <TYPO descr="Typo: In word 'ddddd'">ddddd</TYPO>) {
}
'''
checkTypos()
}
private checkTypos() {
myFixture.enableInspections(new SpellCheckingInspection())
myFixture.checkHighlighting(false, false, true)
}
void testLiteralMethodNames() {
myFixture.configureByText 'a.groovy', '''
class SpockTest {
def "adds a 'play' extension"() { }
def "<TYPO descr="Typo: In word 'addds'">addds</TYPO> a 'play' extension"() { }
}
'''
checkTypos()
}
void testStringEscapes() {
myFixture.configureByText 'a.groovy', '''
def foo = "\\ntest \\n<TYPO descr="Typo: In word 'ddddd'">ddddd</TYPO>"
def foo1 = '\\ntest \\n<TYPO descr="Typo: In word 'ddddd'">ddddd</TYPO>'
def bar = """\\ntest \\n<TYPO descr="Typo: In word 'ddddd'">ddddd</TYPO>"""
def bar1 = \'''\\ntest \\n<TYPO descr="Typo: In word 'ddddd'">ddddd</TYPO>\'''
'''
checkTypos()
public class GroovySpellcheckerTest extends LightJavaCodeInsightFixtureTestCase {
public void testParameterName() {
myFixture.configureByText("a.groovy", """
def test(int <TYPO descr="Typo: In word 'ddddd'">ddddd</TYPO>) {
}
""");
checkTypos();
}
private void checkTypos() {
myFixture.enableInspections(new SpellCheckingInspection());
myFixture.checkHighlighting(false, false, true);
}
public void testLiteralMethodNames() {
myFixture.configureByText("a.groovy", """
class SpockTest {
def "adds a 'play' extension"() { }
def "<TYPO descr="Typo: In word 'addds'">addds</TYPO> a 'play' extension"() { }
}
""");
checkTypos();
}
public void testStringEscapes() {
myFixture.configureByText("a.groovy", """
def foo = "\\ntest \\n<TYPO descr="Typo: In word 'ddddd'">ddddd</TYPO>"
def foo1 = '\\ntest \\n<TYPO descr="Typo: In word 'ddddd'">ddddd</TYPO>'
def bar = ""\"\\ntest \\n<TYPO descr="Typo: In word 'ddddd'">ddddd</TYPO>""\"
def bar1 = '''\\ntest \\n<TYPO descr="Typo: In word 'ddddd'">ddddd</TYPO>'''
""");
checkTypos();
}
}