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

Side by Side Diff: pkg/dart_messages/test/dart_messages_test.dart

Issue 1770703002: Use error-names for 'specializationOf'. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « pkg/dart_messages/lib/shared_messages.dart ('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 // 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 import 'dart:io' as io; 5 import 'dart:io' as io;
6 6
7 import '../lib/shared_messages.dart'; 7 import '../lib/shared_messages.dart';
8 8
9 void testJsonIsUpdated() { 9 void testJsonIsUpdated() {
10 var packageRoot = io.Platform.packageRoot; 10 var packageRoot = io.Platform.packageRoot;
(...skipping 15 matching lines...) Expand all
26 void testIdsAreUnique() { 26 void testIdsAreUnique() {
27 var usedIds = new Set(); 27 var usedIds = new Set();
28 for (var entry in MESSAGES.values) { 28 for (var entry in MESSAGES.values) {
29 var id = "${entry.id}-${entry.subId}"; 29 var id = "${entry.id}-${entry.subId}";
30 if (!usedIds.add(id)) { 30 if (!usedIds.add(id)) {
31 throw "Id appears twice: $id"; 31 throw "Id appears twice: $id";
32 } 32 }
33 } 33 }
34 } 34 }
35 35
36 void testSpecializationsAreOfSameId() {
37 for (var entry in MESSAGES.values) {
38 var specializationOf = entry.specializationOf;
39 if (specializationOf == null) continue;
40 var generic = MESSAGES[specializationOf];
41 if (generic == null) {
42 throw "More generic message doesn't exist: $specializationOf";
43 }
44 if (generic.id != entry.id) {
45 var id = "${entry.id}-${entry.subId}";
46 var genericId = "${generic.id}-${generic.subId}";
47 throw "Specialization doesn't have same id: $id - $genericId";
48 }
49 }
50 }
51
36 void main() { 52 void main() {
37 testJsonIsUpdated(); 53 testJsonIsUpdated();
38 testIdsAreUnique(); 54 testIdsAreUnique();
55 testSpecializationsAreOfSameId();
39 } 56 }
OLDNEW
« no previous file with comments | « pkg/dart_messages/lib/shared_messages.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698