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

Side by Side Diff: pkg/observe/test/unique_message_test.dart

Issue 513023002: Step one towards stable error messages with details: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « pkg/observe/test/transformer_test.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 /// Tests for some of the utility helper functions used by the compiler.
6 library polymer.test.build.messages_test;
7
8 import 'dart:mirrors';
9
10 import 'package:unittest/unittest.dart';
11 import 'package:code_transformers/messages/messages.dart' show Message;
12
13 import 'package:observe/src/messages.dart' as p1;
14
15 /// [p1] is accessed via mirrors, this comment prevents the analyzer from
16 /// complaining about it.
17 main() {
18 test('each message id is unique', () {
19 var seen = {};
20 int total = 0;
21 var mirrors = currentMirrorSystem();
22 var lib = mirrors.findLibrary(#observe.src.messages);
23 expect(lib, isNotNull);
24 lib.declarations.forEach((symbol, decl) {
25 if (decl is! VariableMirror) return;
26 var field = lib.getField(symbol).reflectee;
27 var name = MirrorSystem.getName(symbol);
28 if (field is! Message) return;
29 var id = field.id;
30 expect(seen.containsKey(id), isFalse, reason: 'Duplicate id `$id`. '
31 'Currently set for both `$name` and `${seen[id]}`.');
32 seen[id] = name;
33 total++;
34 });
35 expect(seen.length, total);
36 });
37 }
OLDNEW
« no previous file with comments | « pkg/observe/test/transformer_test.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698