diff options
author | Yuriy Solodkyy <solodkyy@google.com> | 2022-08-01 22:41:07 +0100 |
---|---|---|
committer | TreeHugger Robot <treehugger-gerrit@google.com> | 2022-08-01 22:31:45 +0000 |
commit | dc412e4ca8330b64f39ae09c058735e9db109133 (patch) | |
tree | 92019f8df1aa97779318ace6c0a43b283dc8a7b6 | |
parent | e3b8e42e826566e4a9ef365af7fb89ba809e7bc9 (diff) | |
download | idea-dc412e4ca8330b64f39ae09c058735e9db109133.tar.gz |
Reproduce Lint crash on Gradle Java modules
Bug: 231836975
Test: n/a
Change-Id: I9da43d096f82a86d7ed94d180deae0a9d78be038
-rw-r--r-- | android-lint/testSrc/com/android/tools/idea/lint/AndroidLintIdeProjectGradleIntegrationTest.kt | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/android-lint/testSrc/com/android/tools/idea/lint/AndroidLintIdeProjectGradleIntegrationTest.kt b/android-lint/testSrc/com/android/tools/idea/lint/AndroidLintIdeProjectGradleIntegrationTest.kt new file mode 100644 index 00000000000..5fc07fcb7b1 --- /dev/null +++ b/android-lint/testSrc/com/android/tools/idea/lint/AndroidLintIdeProjectGradleIntegrationTest.kt @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * 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 com.android.tools.idea.lint + +import com.android.tools.idea.lint.common.LintIdeClient +import com.android.tools.idea.lint.common.LintIgnoredResult +import com.android.tools.idea.lint.common.LintResult +import com.android.tools.idea.testing.AndroidProjectRule +import com.android.tools.idea.testing.GradleIntegrationTest +import com.android.tools.idea.testing.TestProjectPaths +import com.android.tools.idea.testing.onEdt +import com.android.tools.idea.testing.openPreparedProject +import com.android.tools.idea.testing.prepareGradleProject +import com.google.common.truth.Expect +import com.google.common.truth.Truth.assertThat +import com.intellij.openapi.module.ModuleManager +import com.intellij.testFramework.RunsInEdt +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import java.io.File + +@RunsInEdt +class AndroidLintIdeProjectGradleIntegrationTest : GradleIntegrationTest { + + @get:Rule + val projectRule = AndroidProjectRule.withAndroidModels().onEdt() + + @get:Rule + var expect = Expect.createAndEnableStackTrace() + + @Test + @Ignore //TODO(b/231836975): Enable and finish when fixed and does not crash anymore. + fun test() { + val result: LintResult = LintIgnoredResult() + prepareGradleProject(TestProjectPaths.TRANSITIVE_DEPENDENCIES, "p") + openPreparedProject("p") { project -> + val client: LintIdeClient = AndroidLintIdeClient(project, result) + val projects = AndroidLintIdeProject.create(client, null, *ModuleManager.getInstance(project).modules) + assertThat(projects).isNotEmpty() + } + } + + override fun getBaseTestPath(): String = projectRule.fixture.tempDirPath + override fun getTestDataDirectoryWorkspaceRelativePath(): String = TestProjectPaths.TEST_DATA_PATH + override fun getAdditionalRepos(): Collection<File> = listOf() +}
\ No newline at end of file |