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

Side by Side Diff: tests/lib/mirrors/other_declarations_location_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.declarations_location; 5 library test.declarations_location;
6 6
7 import "dart:mirrors"; 7 import "dart:mirrors";
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import "library_without_declaration.dart"; 9 import "library_without_declaration.dart";
10 import "library_with_annotated_declaration.dart"; 10 import "library_with_annotated_declaration.dart";
11 11
12 const metadata = 'metadata'; 12 const metadata = 'metadata';
13 13
14 class C<S, @metadata T> { 14 class C<S, @metadata T> {
15 var a; 15 var a;
16 final b = 2; 16 final b = 2;
17 static var c; 17 static var c;
18 static final d = 4; 18 static final d = 4;
19 @metadata var e; 19 @metadata
20 var e;
20 List<C> f; 21 List<C> f;
21 } 22 }
22 23
23
24 // We only check for a suffix of the uri because the test might be run from 24 // We only check for a suffix of the uri because the test might be run from
25 // any number of absolute paths. 25 // any number of absolute paths.
26 expectLocation(DeclarationMirror mirror, String uriSuffix, int line, int column) { 26 expectLocation(
27 DeclarationMirror mirror, String uriSuffix, int line, int column) {
27 Uri uri = mirror.location.sourceUri; 28 Uri uri = mirror.location.sourceUri;
28 Expect.isTrue(uri.toString().endsWith(uriSuffix), 29 Expect.isTrue(
29 » "Expected suffix $uriSuffix in $uri"); 30 uri.toString().endsWith(uriSuffix), "Expected suffix $uriSuffix in $uri");
30 Expect.equals(line, mirror.location.line, "line"); 31 Expect.equals(line, mirror.location.line, "line");
31 Expect.equals(column, mirror.location.column, "column"); 32 Expect.equals(column, mirror.location.column, "column");
32 } 33 }
33 34
34 main() { 35 main() {
35 String mainSuffix = 'other_declarations_location_test.dart'; 36 String mainSuffix = 'other_declarations_location_test.dart';
36 37
37 // Fields. 38 // Fields.
38 expectLocation(reflectClass(C).declarations[#a], mainSuffix, 15, 7); 39 expectLocation(reflectClass(C).declarations[#a], mainSuffix, 15, 7);
39 expectLocation(reflectClass(C).declarations[#b], mainSuffix, 16, 9); 40 expectLocation(reflectClass(C).declarations[#b], mainSuffix, 16, 9);
40 expectLocation(reflectClass(C).declarations[#c], mainSuffix, 17, 14); 41 expectLocation(reflectClass(C).declarations[#c], mainSuffix, 17, 14);
41 expectLocation(reflectClass(C).declarations[#d], mainSuffix, 18, 16); 42 expectLocation(reflectClass(C).declarations[#d], mainSuffix, 18, 16);
42 expectLocation(reflectClass(C).declarations[#e], mainSuffix, 19, 17); 43 expectLocation(reflectClass(C).declarations[#e], mainSuffix, 20, 7);
43 expectLocation(reflectClass(C).declarations[#f], mainSuffix, 20, 11); 44 expectLocation(reflectClass(C).declarations[#f], mainSuffix, 21, 11);
44 45
45 // Type variables. 46 // Type variables.
46 expectLocation(reflectClass(C).declarations[#S], mainSuffix, 14, 9); 47 expectLocation(reflectClass(C).declarations[#S], mainSuffix, 14, 9);
47 expectLocation(reflectClass(C).declarations[#T], mainSuffix, 14, 12); 48 expectLocation(reflectClass(C).declarations[#T], mainSuffix, 14, 12);
48 49
49 // Libraries. 50 // Libraries.
50 expectLocation(reflectClass(C).owner, mainSuffix, 5, 1); 51 expectLocation(reflectClass(C).owner, mainSuffix, 5, 1);
51 expectLocation(reflectClass(ClassInLibraryWithoutDeclaration).owner, 52 expectLocation(reflectClass(ClassInLibraryWithoutDeclaration).owner,
52 "library_without_declaration.dart", 1, 1); 53 "library_without_declaration.dart", 1, 1);
53 expectLocation(reflectClass(ClassInLibraryWithAnnotatedDeclaration).owner, 54 expectLocation(reflectClass(ClassInLibraryWithAnnotatedDeclaration).owner,
54 "library_with_annotated_declaration.dart", 5, 1); 55 "library_with_annotated_declaration.dart", 5, 1);
55 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698