Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coverage for lint issue registry. #385

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions formula-lint/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import com.android.build.gradle.internal.lint.AndroidLintAnalysisTask
import com.android.build.gradle.internal.lint.LintModelWriterTask

plugins {
id("java-library")
id("kotlin")
Expand All @@ -21,4 +18,5 @@ dependencies {
testImplementation(libs.lint.core)
testImplementation(libs.lint.tests)
testImplementation(libs.junit)
testImplementation(libs.truth)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.instacart.formula.lint

import com.android.tools.lint.checks.infrastructure.TestLintTask
import com.android.tools.lint.detector.api.CURRENT_API
import com.google.common.truth.Truth
import org.junit.Test

@Suppress("CheckResult")
class FormulaIssueRegistryTest {

@Test fun issues() {
TestLintTask.lint()

val issues = FormulaIssueRegistry().issues
Truth.assertThat(issues).hasSize(2)
}

@Test fun apiVersions() {
TestLintTask.lint()

Truth.assertThat(FormulaIssueRegistry().api).isEqualTo(CURRENT_API)
Truth.assertThat(FormulaIssueRegistry().minApi).isEqualTo(7)
}

@Test fun vendor() {
TestLintTask.lint()

val vendor = FormulaIssueRegistry().vendor
Truth.assertThat(vendor.vendorName).isEqualTo("Instacart/formula")
Truth.assertThat(vendor.identifier).isEqualTo("com.instacart.formula:formula:{version}")
Truth.assertThat(vendor.feedbackUrl).isEqualTo("https://github.com/Instacart/formula/issues")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import com.android.tools.lint.checks.infrastructure.TestLintResult
import com.android.tools.lint.checks.infrastructure.TestLintTask.lint
import com.android.tools.lint.checks.infrastructure.TestMode
import com.instacart.formula.lint.WrongFormulaUsageDetector.Companion.issues
import com.intellij.lang.PsiBuilderUtil.expect
import org.junit.Test

class WrongFormulaUsageDetectorTest {
Expand Down
Loading