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

Side by Side Diff: pkg/analyzer/test/src/dart/analysis/defined_names_test.dart

Issue 2670843004: Record defined top-level/class-mebber names with unlinked bundles. (Closed)
Patch Set: Created 3 years, 10 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
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'package:analyzer/dart/ast/ast.dart';
6 import 'package:analyzer/src/dart/analysis/defined_names.dart';
7 import 'package:test/test.dart';
8 import 'package:test_reflective_loader/test_reflective_loader.dart';
9
10 import '../../../generated/parser_test.dart';
11
12 main() {
13 defineReflectiveSuite(() {
14 defineReflectiveTests(DefinedNamesTest);
15 });
16 }
17
18 @reflectiveTest
19 class DefinedNamesTest {
20 test_classMemberNames() {
21 DefinedNames names = _computeDefinedNames('''
22 class A {
23 int a, b;
24 A();
25 A.c();
26 d() {}
27 get e => null;
28 set f(_) {}
29 }
30 class B {
31 g() {}
32 }
33 ''');
34 expect(names.topLevelNames, unorderedEquals(['A', 'B']));
35 expect(names.classMemberNames,
36 unorderedEquals(['a', 'b', 'd', 'e', 'f', 'g']));
37 }
38
39 test_topLevelNames() {
40 DefinedNames names = _computeDefinedNames('''
41 class A {}
42 class B = Object with A;
43 typedef C {}
44 D() {}
45 get E => null;
46 set F(_) {}
47 var G, H;
48 ''');
49 expect(names.topLevelNames,
50 unorderedEquals(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']));
51 expect(names.classMemberNames, isEmpty);
52 }
53
54 DefinedNames _computeDefinedNames(String code) {
55 CompilationUnit unit = ParserTestCase.parseCompilationUnit2(code);
56 return computeDefinedNames(unit);
57 }
58 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/test/src/dart/analysis/file_state_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698