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

Side by Side Diff: runtime/observatory/tests/service/address_mapper_test.dart

Issue 1238803002: Make observatory tests analyzer clean (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | runtime/observatory/tests/service/library_dependency_test.dart » ('j') | 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 // VMOptions=--compile_all --error_on_bad_type --error_on_bad_override 4 // VMOptions=--compile_all --error_on_bad_type --error_on_bad_override
5 5
6 import 'package:observatory/object_graph.dart'; 6 import 'package:observatory/object_graph.dart';
7 import 'package:expect/expect.dart'; 7 import 'package:unittest/unittest.dart';
8
9 dynamic confuse() {
10 if (true) {
11 return "5";
12 }
13 return 5;
14 }
8 15
9 main() { 16 main() {
10 var map = new AddressMapper(42); 17 var map = new AddressMapper(42);
11 18
12 Expect.equals(null, map.get(1, 2, 3)); 19 expect(map.get(1, 2, 3), isNull);
13 Expect.equals(4, map.put(1, 2, 3, 4)); 20 expect(map.put(1, 2, 3, 4), equals(4));
14 Expect.equals(4, map.get(1, 2, 3)); 21 expect(map.get(1, 2, 3), equals(4));
15 22
16 Expect.equals(null, map.get(2, 3, 1)); 23 expect(map.get(2, 3, 1), isNull);
17 Expect.equals(null, map.get(3, 1, 2)); 24 expect(map.get(3, 1, 2), isNull);
18 25
19 Expect.throws(() => map.put(1, 2, 3, 44), 26 bool exceptionThrown = false;
20 (e) => true, 27 try {
21 "Overwrite key"); 28 expect(exceptionThrown, isFalse);
29 map.put(1, 2, 3, 44);
30 expect(true, isFalse);
31 } catch (e) {
32 exceptionThrown = true;
33 }
34 expect(exceptionThrown, isTrue);
22 35
23 Expect.throws(() => map.put(5, 6, 7, 0), 36 exceptionThrown = false;
24 (e) => true, 37 try {
25 "Invalid value"); 38 expect(exceptionThrown, isFalse);
39 map.put(5, 6, 7, 0);
40 expect(true, isFalse);
41 } catch (e) {
42 exceptionThrown = true;
43 }
44 expect(exceptionThrown, isTrue);
26 45
27 Expect.throws(() => map.put("5", 6, 7, 0), 46 exceptionThrown = false;
28 (e) => true, 47 try {
29 "Invalid key"); 48 expect(exceptionThrown, isFalse);
49 map.put(confuse(), 6, 7, 0);
50 expect(true, isFalse);
51 } catch (e) {
52 exceptionThrown = true;
53 }
54 expect(exceptionThrown, isTrue);
30 } 55 }
OLDNEW
« no previous file with comments | « no previous file | runtime/observatory/tests/service/library_dependency_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698