as31: Fix test data for android lint based tests for AS 3.0
This commit is contained in:
committed by
Nikolay Krasko
parent
e12e63572c
commit
4c498b004f
@@ -0,0 +1,36 @@
|
||||
// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSupportAnnotationUsageInspection
|
||||
// DEPENDENCY: IntRange.java -> android/support/annotation/IntRange.java
|
||||
// DEPENDENCY: RequiresPermission.java -> android/support/annotation/RequiresPermission.java
|
||||
|
||||
|
||||
import android.support.annotation.IntRange
|
||||
import android.support.annotation.RequiresPermission
|
||||
import android.Manifest
|
||||
import android.view.View
|
||||
|
||||
const val constantVal = 0L
|
||||
|
||||
<error descr="Invalid range: the `from` attribute must be less than the `to` attribute">@IntRange(from = 10, to = 0)</error>
|
||||
fun invalidRange1a(): Int = 5
|
||||
|
||||
@IntRange(from = constantVal, to = 10) // ok
|
||||
fun invalidRange0b(): Int = 5
|
||||
|
||||
<error descr="Invalid range: the `from` attribute must be less than the `to` attribute">@IntRange(from = 10, to = constantVal)</error>
|
||||
fun invalidRange1b(): Int = 5
|
||||
|
||||
|
||||
// should be ok, KT-16600
|
||||
@RequiresPermission(anyOf = arrayOf(Manifest.permission.ACCESS_CHECKIN_PROPERTIES,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION))
|
||||
fun needsPermissions1() { }
|
||||
|
||||
// should be ok, KT-16600
|
||||
@RequiresPermission(Manifest.permission.ACCESS_CHECKIN_PROPERTIES)
|
||||
fun needsPermissions2() { }
|
||||
|
||||
// error
|
||||
<error descr="Only specify one of `value`, `anyOf` or `allOf`">@RequiresPermission(
|
||||
value = Manifest.permission.ACCESS_CHECKIN_PROPERTIES,
|
||||
anyOf = arrayOf(Manifest.permission.ACCESS_CHECKIN_PROPERTIES, Manifest.permission.ACCESS_FINE_LOCATION))</error>
|
||||
fun needsPermissions3() { }
|
||||
Reference in New Issue
Block a user