[grazie] IJPL-200544 Migrate tests from spellchecker to grazie module

Merge-request: IJ-MR-175297
Merged-by: Ilia Permiashkin <ilia.permiashkin@jetbrains.com>

GitOrigin-RevId: f2d353c8b8516cf2a3b3fe0622147787c8a26066
This commit is contained in:
Ilia Permiashkin
2025-09-16 16:58:12 +00:00
committed by intellij-monorepo-bot
parent 1c9d755376
commit bea0075b8f
32 changed files with 60 additions and 30 deletions

View File

@@ -6,6 +6,7 @@ import com.intellij.grazie.GrazieTestBase
import com.intellij.grazie.jlanguage.Lang
import com.intellij.grazie.text.TextChecker
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.util.Disposer
import com.intellij.testFramework.TemporaryDirectory
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.util.download.DownloadableFileService
@@ -24,6 +25,7 @@ class LanguageToolBundleInfoTest : BasePlatformTestCase() {
override fun setUp() {
super.setUp()
GrazieTestBase.maskSaxParserFactory(testRootDisposable)
Disposer.register(testRootDisposable) { GrazieConfig.update { GrazieConfig.State() } }
}
/**
@@ -33,6 +35,8 @@ class LanguageToolBundleInfoTest : BasePlatformTestCase() {
*/
@Test
fun `check that all languages are loaded correctly`() {
// Do not run this test on build server, since artifact downloading will produce flaky failures
Assume.assumeTrue("Must not be run under TeamCity", !IS_UNDER_TEAMCITY)
Lang.entries.filter { it.ltRemote != null }.map { lang ->
var jLanguage = lang.jLanguage
if (jLanguage == null) {

View File

@@ -1,8 +1,8 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.dataset
package com.intellij.grazie.spellchecker.dataset
import com.intellij.grazie.spellchecker.inspection.SpellcheckerInspectionTestCase
import com.intellij.spellchecker.SpellCheckerManager
import com.intellij.spellchecker.inspection.SpellcheckerInspectionTestCase
import com.intellij.tools.ide.metrics.benchmark.Benchmark

View File

@@ -1,9 +1,9 @@
// Copyright 2000-2020 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.spellchecker.dataset
package com.intellij.grazie.spellchecker.dataset
import com.intellij.grazie.spellchecker.dataset.Datasets.WordWithMisspellings
import com.intellij.grazie.spellchecker.inspection.SpellcheckerInspectionTestCase
import com.intellij.spellchecker.SpellCheckerManager
import com.intellij.spellchecker.dataset.Datasets.WordWithMisspellings
import com.intellij.spellchecker.inspection.SpellcheckerInspectionTestCase
import kotlin.test.assertFalse
import kotlin.test.assertTrue
@@ -27,7 +27,7 @@ class DataSetQualityTest : SpellcheckerInspectionTestCase() {
assertLessThanOrEqualMaxWordLength("${word.word} exceeds max word length $MAX_WORD_LENGTH", word.word.length)
word.misspellings.forEach { misspelling ->
assertTrue(manager.hasProblem(misspelling), "$misspelling should be misspelled, but it is")
assertTrue(manager.hasProblem(misspelling), "$misspelling should be misspelled, but it is not")
assertLessThanOrEqualMaxWordLength("$misspelling exceeds max word length $MAX_WORD_LENGTH", misspelling.length)
}
}

View File

@@ -1,4 +1,4 @@
package com.intellij.spellchecker.dataset
package com.intellij.grazie.spellchecker.dataset
object Datasets {
data class WordWithMisspellings(val word: String, val misspellings: LinkedHashSet<String>)

View File

@@ -1,8 +1,11 @@
// 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.
package com.intellij.spellchecker.dictionary;
package com.intellij.grazie.spellchecker.dictionary;
import com.intellij.spellchecker.inspection.SpellcheckerInspectionTestCase;
import com.intellij.grazie.spellchecker.inspection.SpellcheckerInspectionTestCase;
import com.intellij.spellchecker.dictionary.Dictionary;
import com.intellij.spellchecker.dictionary.EditableDictionary;
import com.intellij.spellchecker.dictionary.UserDictionary;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2020 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.spellchecker.dictionary;
package com.intellij.grazie.spellchecker.dictionary;
import com.intellij.grazie.spellchecker.inspection.SpellcheckerInspectionTestCase;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.io.FileUtil;
@@ -8,7 +9,6 @@ import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.spellchecker.SpellCheckerManager;
import com.intellij.spellchecker.inspection.SpellcheckerInspectionTestCase;
import com.intellij.spellchecker.settings.SpellCheckerSettings;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.util.PathUtil;
@@ -20,7 +20,6 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import static com.intellij.openapi.util.io.FileUtilRt.extensionEquals;
import static com.intellij.spellchecker.SpellCheckerManagerKt.isDic;
public class CustomDictionaryTest extends SpellcheckerInspectionTestCase {

View File

@@ -1,7 +1,10 @@
// 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.
package com.intellij.spellchecker.dictionary;
package com.intellij.grazie.spellchecker.dictionary;
import com.intellij.spellchecker.inspection.SpellcheckerInspectionTestCase;
import com.intellij.grazie.spellchecker.inspection.SpellcheckerInspectionTestCase;
import com.intellij.spellchecker.dictionary.Dictionary;
import com.intellij.spellchecker.dictionary.ProjectDictionary;
import com.intellij.spellchecker.dictionary.UserDictionary;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.spellchecker.inspection;
package com.intellij.grazie.spellchecker.inspection;
import java.util.Locale;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.spellchecker.inspection;
package com.intellij.grazie.spellchecker.inspection;
/**
* @author Konstantin Bulenkov

View File

@@ -1,5 +1,5 @@
// Copyright 2000-2020 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.spellchecker.inspection
package com.intellij.grazie.spellchecker.inspection
import com.intellij.spellchecker.SpellCheckerManager

View File

@@ -1,5 +1,5 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.inspection;
package com.intellij.grazie.spellchecker.inspection;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.spellchecker.inspections.SpellCheckingInspection;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.spellchecker.inspection;
package com.intellij.grazie.spellchecker.inspection;
import com.intellij.codeHighlighting.Pass;
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerEx;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.spellchecker.inspection;
package com.intellij.grazie.spellchecker.inspection;
/**
* @author Ekaterina Shliakhovetskaja

View File

@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.spellchecker.inspection.quickfixes;
package com.intellij.grazie.spellchecker.inspection.quickfixes;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.spellchecker.inspection.SpellcheckerInspectionTestCase;
import com.intellij.grazie.spellchecker.inspection.SpellcheckerInspectionTestCase;
import com.intellij.spellchecker.inspections.SpellCheckingInspection;
import com.intellij.spellchecker.quickfixes.ChangeTo;
import com.intellij.util.containers.ContainerUtil;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.spellchecker.inspection.quickfixes;
package com.intellij.grazie.spellchecker.inspection.quickfixes;
public class JavaSpellCheckerFixesTest extends AbstractSpellCheckerFixesTest {
@Override

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.spellchecker.inspection.quickfixes;
package com.intellij.grazie.spellchecker.inspection.quickfixes;
import com.intellij.spellchecker.quickfixes.ChangeTo;
import com.intellij.spellchecker.quickfixes.RenameTo;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.spellchecker.inspection.quickfixes;
package com.intellij.grazie.spellchecker.inspection.quickfixes;
public class XmlSpellCheckerFixesTest extends AbstractSpellCheckerFixesTest {
@Override

View File

@@ -1,5 +1,5 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.inspector;
package com.intellij.grazie.spellchecker.inspector;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.command.impl.UndoManagerImpl;

View File

@@ -1,5 +1,5 @@
// 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.spellchecker.inspector;
package com.intellij.grazie.spellchecker.inspector;
import com.intellij.openapi.util.TextRange;
import com.intellij.spellchecker.inspections.*;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.spellchecker.inspector;
package com.intellij.grazie.spellchecker.inspector;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.registry.RegistryValue;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.spellchecker.ui;
package com.intellij.grazie.spellchecker.ui;
import com.intellij.codeInspection.ex.InspectionProfileImpl;
import com.intellij.openapi.command.WriteCommandAction;

View File

@@ -83,6 +83,7 @@ jvm_library(
"//xml/impl",
"//spellchecker",
"//spellchecker:spellchecker_test_lib",
"//plugins/grazie/src/test:grazie-tests_test_lib",
"//plugins/grazie/src:core",
"//plugins/grazie",
"//java/java-impl:impl",

View File

@@ -30,6 +30,7 @@
<orderEntry type="module" module-name="intellij.platform.lang.core" />
<orderEntry type="module" module-name="intellij.xml.impl" />
<orderEntry type="module" module-name="intellij.spellchecker" scope="TEST" />
<orderEntry type="module" module-name="intellij.grazie.tests" scope="TEST" />
<orderEntry type="module" module-name="intellij.grazie.core" scope="TEST" />
<orderEntry type="module" module-name="intellij.grazie" scope="TEST" />
<orderEntry type="module" module-name="intellij.java.impl" exported="" />

View File

@@ -3,6 +3,7 @@ package com.intellij.spellchecker.inspection;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
import com.intellij.grazie.spellchecker.inspection.SpellcheckerInspectionTestCase;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.testFramework.DumbModeTestUtils;

View File

@@ -17,6 +17,7 @@ package com.intellij.spellchecker.inspection;
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.grazie.spellchecker.inspection.SpellcheckerInspectionTestCase;
import com.intellij.openapi.application.PluginPathManager;
import org.jetbrains.annotations.NotNull;

View File

@@ -122,7 +122,6 @@ iexact
indexfcn
inlineformset
intcomma
intring
intword
invali
invflattening

View File

@@ -0,0 +1,7 @@
Do not delete this class and `testSrc` / `testResources` folders.
Deletion of these files will result into regenerating BUILD.bazel files
and across whole project on top of bazel-targets.json, that will trigger recompilation of things
in Rider that haven't been compiled in a long time, causing Safe Push to constantly fail.
https://youtrack.jetbrains.com/issue/RIDER-130267

View File

@@ -0,0 +1,11 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker;
/*
* Do not delete this class and `testSrc` / `testResources` folders.
*
* Please read `ReadMe.md` file in the `testResources` folder for the explanation.
*/
@SuppressWarnings("unused")
public class ReadMe {}