aboutsummaryrefslogtreecommitdiffstats
path: root/lint/cli
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-08-06 13:16:22 -0700
committerTor Norbye <tnorbye@google.com>2012-08-06 13:16:22 -0700
commit8ae549d926c4233479dc8f1cb268e45cf6284e05 (patch)
tree61cb2b27e59073f1371cdd8032a5c8b1348661a7 /lint/cli
parent81245308f77fcaddb0498463cf477bcfe92ea508 (diff)
downloadsdk-8ae549d926c4233479dc8f1cb268e45cf6284e05.zip
sdk-8ae549d926c4233479dc8f1cb268e45cf6284e05.tar.gz
sdk-8ae549d926c4233479dc8f1cb268e45cf6284e05.tar.bz2
Update lint unit test golden files to contain more details
The lint golden files was using a custom unit test reporter which wrote out the test strings in alphabetical order. However, this output was missing some information such as the actual source lines containing the error and the particular error range underlined, which the CLI prints. This changeset replaces the unit test reporter with the CLI one, which not only has the benefit of providing more details in the unit tests (which for example shows that bytecode based issues correctly identify the right source level range), but it also tests the CLI reporter itself such as its sorting. Other than a minor fix to handling \r's in the CLI error output, this changeset does not contain any changes to any of the lint detectors, it just updates the golden files. Change-Id: Iae8f13a47efe6ba5e5cfd84af0dd548f78513879
Diffstat (limited to 'lint/cli')
-rw-r--r--lint/cli/src/com/android/tools/lint/Main.java47
1 files changed, 25 insertions, 22 deletions
diff --git a/lint/cli/src/com/android/tools/lint/Main.java b/lint/cli/src/com/android/tools/lint/Main.java
index 6cdb689..20825cb 100644
--- a/lint/cli/src/com/android/tools/lint/Main.java
+++ b/lint/cli/src/com/android/tools/lint/Main.java
@@ -105,29 +105,29 @@ public class Main extends LintClient {
private static final int ERRNO_HELP = 4;
private static final int ERRNO_INVALIDARGS = 5;
- private List<Warning> mWarnings = new ArrayList<Warning>();
- private Set<String> mSuppress = new HashSet<String>();
- private Set<String> mEnabled = new HashSet<String>();
+ protected List<Warning> mWarnings = new ArrayList<Warning>();
+ protected Set<String> mSuppress = new HashSet<String>();
+ protected Set<String> mEnabled = new HashSet<String>();
/** If non-null, only run the specified checks (possibly modified by enable/disables) */
- private Set<String> mCheck = null;
- private boolean mHasErrors;
- private boolean mSetExitCode;
- private boolean mFullPath;
- private int mErrorCount;
- private int mWarningCount;
- private boolean mShowLines = true;
- private List<Reporter> mReporters = Lists.newArrayList();
- private boolean mQuiet;
- private boolean mWarnAll;
- private boolean mNoWarnings;
- private boolean mAllErrors;
- private List<File> mSources;
- private List<File> mClasses;
-
- private Configuration mDefaultConfiguration;
- private IssueRegistry mRegistry;
- private LintDriver mDriver;
- private boolean mShowAll;
+ protected Set<String> mCheck = null;
+ protected boolean mHasErrors;
+ protected boolean mSetExitCode;
+ protected boolean mFullPath;
+ protected int mErrorCount;
+ protected int mWarningCount;
+ protected boolean mShowLines = true;
+ protected List<Reporter> mReporters = Lists.newArrayList();
+ protected boolean mQuiet;
+ protected boolean mWarnAll;
+ protected boolean mNoWarnings;
+ protected boolean mAllErrors;
+ protected List<File> mSources;
+ protected List<File> mClasses;
+
+ protected Configuration mDefaultConfiguration;
+ protected IssueRegistry mRegistry;
+ protected LintDriver mDriver;
+ protected boolean mShowAll;
/** Creates a CLI driver */
public Main() {
@@ -1149,6 +1149,9 @@ public class Main extends LintClient {
static String getLineOfOffset(String contents, int offset) {
int end = contents.indexOf('\n', offset);
+ if (end == -1) {
+ end = contents.indexOf('\r', offset);
+ }
return contents.substring(offset, end != -1 ? end : contents.length());
}