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

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

Issue 1514333002: Add dart_messages package. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove obsolete test. Created 5 years 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/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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:convert';
6 import 'dart:io';
7
8 import '../lib/shared_messages.dart';
9
10 void testJsonIsUpdated() {
11 var packageRoot = Platform.packageRoot;
12 if (packageRoot == null || packageRoot == "") {
13 throw new UnsupportedError("This test requires a package root.");
14 }
15 var jsonUri =
16 Uri.parse(packageRoot).resolve('dart_messages/shared_messages.json');
17 var jsonPath = jsonUri.toFilePath();
18 var content = new File(jsonPath).readAsStringSync();
19 if (JSON.encode(MESSAGES) != content) {
20 throw "Content is not the same";
Siggi Cherem (dart-lang) 2015/12/17 00:06:56 Consider adding here instructions on how to regene
floitsch 2015/12/17 07:27:17 I added instructions what to do when the test fail
21 }
22 }
23
24 void testIdsAreUnique() {
25 var usedIds = new Set();
26 for (var entry in MESSAGES.values) {
27 var id = entry['id'];
28 if (!usedIds.add(id)) {
29 throw "Id appears twice: $id";
30 }
31 }
32 }
33
34 void main() {
35 testJsonIsUpdated();
36 testIdsAreUnique();
37 }
OLDNEW
« no previous file with comments | « pkg/dart_messages/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698