Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(596)

Unified Diff: pkg/analyzer/test/generated/all_the_rest_test.dart

Issue 1040573002: Fix NPE in ErrorReporter (issue 22980) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/all_the_rest_test.dart
diff --git a/pkg/analyzer/test/generated/all_the_rest_test.dart b/pkg/analyzer/test/generated/all_the_rest_test.dart
index 23959e4d521ae6cefcddcb05136e000c255089e6..ee04d272d422537ed9a61591952a137982c8cb86 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -126,9 +126,8 @@ abstract class AbstractScannerTest {
}
void test_tokenize_directive_xml() {
- _tokenize("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>", <Object>[
- "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
- ]);
+ _tokenize("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",
+ <Object>["<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"]);
}
void test_tokenize_directives_incomplete_with_newline() {
@@ -5706,10 +5705,9 @@ class ElementBuilderTest extends EngineTestCase {
String firstTypeParameterName = "A";
String secondTypeParameterName = "B";
TypeAlias typeAlias = AstFactory.typeAlias(null, aliasName, AstFactory
- .typeParameterList([
- firstTypeParameterName,
- secondTypeParameterName
- ]), AstFactory.formalParameterList());
+ .typeParameterList(
+ [firstTypeParameterName, secondTypeParameterName]),
+ AstFactory.formalParameterList());
typeAlias.accept(builder);
List<FunctionTypeAliasElement> aliases = holder.typeAliases;
expect(aliases, hasLength(1));
@@ -6421,6 +6419,31 @@ class ErrorReporterTest extends EngineTestCase {
expect(new ErrorReporter(listener, source), isNotNull);
}
+ void test_reportErrorForElement_named() {
+ DartType type = createType("/test1.dart", "A");
+ ClassElement element = type.element;
+ GatheringErrorListener listener = new GatheringErrorListener();
+ ErrorReporter reporter = new ErrorReporter(listener, element.source);
+ reporter.reportErrorForElement(
+ StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER,
+ element, ['A']);
+ AnalysisError error = listener.errors[0];
+ expect(error.offset, element.nameOffset);
+ }
+
+ void test_reportErrorForElement_unnamed() {
+ ImportElementImpl element =
+ ElementFactory.importFor(ElementFactory.library(null, ''), null);
+ GatheringErrorListener listener = new GatheringErrorListener();
+ ErrorReporter reporter = new ErrorReporter(
+ listener, new NonExistingSource("/test.dart", UriKind.FILE_URI));
+ reporter.reportErrorForElement(
+ StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER,
+ element, ['A']);
+ AnalysisError error = listener.errors[0];
+ expect(error.offset, element.nameOffset);
+ }
+
void test_reportTypeErrorForNode_differentNames() {
DartType firstType = createType("/test1.dart", "A");
DartType secondType = createType("/test2.dart", "B");
@@ -7394,9 +7417,8 @@ $scriptBody
</html>""");
_validate(htmlUnit, [
_t4("html", [
- _t4("body", [
- _t("script", _a(["type", "'application/dart'"]), scriptBody)
- ])
+ _t4("body",
+ [_t("script", _a(["type", "'application/dart'"]), scriptBody)])
])
]);
}
@@ -7464,9 +7486,8 @@ $scriptBody
// ht.XmlTagNode.getContent() does not include whitespace
// between '<' and '>' at this time
_validate(htmlUnit, [
- _t3("html", "\n<pa=\"b\">blat \n </p>\n", [
- _t("p", _a(["a", "\"b\""]), "blat \n ")
- ])
+ _t3("html", "\n<pa=\"b\">blat \n </p>\n",
+ [_t("p", _a(["a", "\"b\""]), "blat \n ")])
]);
}
void test_parse_content_none() {
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698