-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathAndroidLintActionArgsTest.kt
More file actions
79 lines (75 loc) · 2.75 KB
/
AndroidLintActionArgsTest.kt
File metadata and controls
79 lines (75 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.rules.android.lint.cli
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import java.nio.file.Paths
@RunWith(JUnit4::class)
class AndroidLintActionArgsTest {
@Test
fun `does parse all arguments`() {
val parseArgs = AndroidLintActionArgs.parseArgs(
args = listOf(
"--label",
"test",
"--android-lint-cli-tool",
"path/to/cli.jar",
"--src",
"path/to/Foo.kt",
"--output",
"output.jar",
"--resource",
"path/to/resource/strings.xml",
"--android-manifest",
"AndroidManifest.xml",
"--android-merged-manifest",
"processed/AndroidManifest.xml",
"--baseline-file",
"lib_lint_baseline.xml",
"--config-file",
"lint_config.xml",
"--custom-rule",
"custom_rule.jar",
"--classpath",
"classpath.jar",
"--classpath",
"classpath.aar",
"--autofix",
"--regenerate-baseline-files",
"--warnings-as-errors",
"--enable-check",
"custom-check",
"--disable-check",
"custom-disabled-check",
"--compile-sdk-version",
"1.6",
"--java-language-level",
"1.7",
"--kotlin-language-level",
"1.8",
"--enable-check-dependencies",
),
)
assertThat(parseArgs.label).isEqualTo("test")
assertThat(parseArgs.srcs).containsExactly(Paths.get("path/to/Foo.kt"))
assertThat(parseArgs.output).isEqualTo(Paths.get("output.jar"))
assertThat(parseArgs.resources).containsExactly(Paths.get("path/to/resource/strings.xml"))
assertThat(parseArgs.baselineFile).isEqualTo(Paths.get("lib_lint_baseline.xml"))
assertThat(parseArgs.config).isEqualTo(Paths.get("lint_config.xml"))
assertThat(parseArgs.customChecks).containsExactly(Paths.get("custom_rule.jar"))
assertThat(parseArgs.classpath)
.containsExactly(Paths.get("classpath.jar"), Paths.get("classpath.aar"))
assertThat(parseArgs.autofix).isTrue
assertThat(parseArgs.regenerateBaselineFile).isTrue
assertThat(parseArgs.warningsAsErrors).isTrue
assertThat(parseArgs.enableChecks).containsExactly("custom-check")
assertThat(parseArgs.disableChecks).containsExactly("custom-disabled-check")
assertThat(parseArgs.compileSdkVersion).isEqualTo("1.6")
assertThat(parseArgs.javaLanguageLevel).isEqualTo("1.7")
assertThat(parseArgs.kotlinLanguageLevel).isEqualTo("1.8")
assertThat(parseArgs.enableCheckDependencies).isTrue()
assertThat(parseArgs.androidManifest).isEqualTo(Paths.get("AndroidManifest.xml"))
assertThat(parseArgs.androidMergedManifest)
.isEqualTo(Paths.get("processed/AndroidManifest.xml"))
}
}