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

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

Issue 1418973002: Error reporting for spans. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
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 25c34650ac60a763244c2b619fa664f213b8480a..e23b92123534ea40b57c27f5ff1686dc3f77678e 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -31,6 +31,7 @@ import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/task/dart.dart';
import 'package:path/path.dart';
import 'package:unittest/unittest.dart';
+import 'package:yaml/yaml.dart';
import '../reflective_tests.dart';
import '../utils.dart';
@@ -7299,6 +7300,27 @@ class ErrorReporterTest extends EngineTestCase {
return element.type;
}
+ void test_reportErrorForSpan() {
+ GatheringErrorListener listener = new GatheringErrorListener();
+ ErrorReporter reporter = new ErrorReporter(
+ listener,
+ new NonExistingSource(
Brian Wilkerson 2015/10/22 00:13:00 It's not a problem for this test because you're no
+ '/test.yaml', toUri('/test.yaml'), UriKind.FILE_URI));
+
+ var src = '''
+foo: bar
+zap: baz
+''';
+
+ YamlMap node = loadYamlNode(src);
+ YamlNode bazNode = node.nodes['zap'];
scheglov 2015/10/21 23:47:21 I think YAML adds extra complexity here. Why not c
pquitslund 2015/10/21 23:56:57 Mainly because I want to ensure that the spans tha
Brian Wilkerson 2015/10/22 00:13:00 Technically, testing whether the yaml parser produ
+ reporter.reportErrorForSpan(AnalysisOptionsWarningCode.UNSUPPORTED_OPTION,
+ bazNode.span, ['test', 'zap']);
+ expect(listener.errors, hasLength(1));
+ expect(listener.errors.first.offset, src.indexOf('baz'));
+ expect(listener.errors.first.length, 'baz'.length);
+ }
+
void test_creation() {
GatheringErrorListener listener = new GatheringErrorListener();
TestSource source = new TestSource();
« pkg/analyzer/lib/src/generated/error.dart ('K') | « 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