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

Side by Side Diff: test/reserved_names_test.dart

Issue 66383002: Update Dart protoc plugin to latest SDK (Closed) Base URL: https://github.com/dart-lang/dart-protoc-plugin.git@master
Patch Set: Created 7 years, 1 month 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
« pubspec.yaml ('K') | « pubspec.yaml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 library reserved_names_test; 6 library reserved_names_test;
7 7
8 import 'dart:mirrors' as mirrors; 8 import 'dart:mirrors' as mirrors;
9 9
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 11
12 import '../lib/protoc.dart' show MessageGenerator; 12 import '../lib/protoc.dart' show MessageGenerator;
13 13
14 import 'test_util.dart'; 14 import 'test_util.dart';
15 15
16 void main() { 16 void main() {
17 test('testReservedNamesList', () { 17 test('testReservedNamesList', () {
18 Set<String> names = new Set<String>(); 18 Set<String> names = new Set<String>();
19 fillConflictingNames(ClassMirror cls) { 19 fillConflictingNames(mirrors.ClassMirror cls) {
20 String className = mirrors.MirrorSystem.getName(cls.simpleName); 20 String className = mirrors.MirrorSystem.getName(cls.simpleName);
21 names.addAll( 21 names.addAll(
22 cls 22 cls
23 .constructors 23 .constructors
24 .values 24 .values
25 .where((ctor) => !ctor.isPrivate) 25 .where((ctor) => !ctor.isPrivate)
26 .map((m) => mirrors.MirrorSystem.getName(m.simpleName)) 26 .map((m) => mirrors.MirrorSystem.getName(m.simpleName))
27 .map((n) => n.startsWith(className + '.') 27 .map((n) => n.startsWith(className + '.')
28 ? n.substring(className.length + 1) : n) 28 ? n.substring(className.length + 1) : n)
29 .toList()); 29 .toList());
(...skipping 10 matching lines...) Expand all
40 .classes[#GeneratedMessage]; 40 .classes[#GeneratedMessage];
41 do { 41 do {
42 fillConflictingNames(cls); 42 fillConflictingNames(cls);
43 cls = cls.superclass; 43 cls = cls.superclass;
44 } while (cls != null); 44 } while (cls != null);
45 45
46 var x = new Set<String>()..addAll(MessageGenerator.reservedNames); 46 var x = new Set<String>()..addAll(MessageGenerator.reservedNames);
47 expect(names.toList()..sort(), equals(x.toList()..sort())); 47 expect(names.toList()..sort(), equals(x.toList()..sort()));
48 }); 48 });
49 } 49 }
OLDNEW
« pubspec.yaml ('K') | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698