Skip to content

Commit

Permalink
Add coverage for lint issue registry. (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
Laimiux authored Sep 10, 2024
1 parent 8fde402 commit d2d205a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
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

0 comments on commit d2d205a

Please sign in to comment.