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

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
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() { return "5"; }
8 10
9 main() { 11 main() {
10 var map = new AddressMapper(42); 12 var map = new AddressMapper(42);
11 13
12 Expect.equals(null, map.get(1, 2, 3)); 14 expect(map.get(1, 2, 3), isNull);
13 Expect.equals(4, map.put(1, 2, 3, 4)); 15 expect(map.put(1, 2, 3, 4), equals(4));
14 Expect.equals(4, map.get(1, 2, 3)); 16 expect(map.get(1, 2, 3), equals(4));
15 17
16 Expect.equals(null, map.get(2, 3, 1)); 18 expect(map.get(2, 3, 1), isNull);
17 Expect.equals(null, map.get(3, 1, 2)); 19 expect(map.get(3, 1, 2), isNull);
18 20
19 Expect.throws(() => map.put(1, 2, 3, 44), 21 bool exceptionThrown = false;
20 (e) => true, 22 try {
21 "Overwrite key"); 23 expect(exceptionThrown, isFalse);
24 map.put(1, 2, 3, 44);
25 expect(true, isFalse);
26 } catch (e) {
27 exceptionThrown = true;
28 }
29 expect(exceptionThrown, isTrue);
22 30
23 Expect.throws(() => map.put(5, 6, 7, 0), 31 exceptionThrown = false;
24 (e) => true, 32 try {
25 "Invalid value"); 33 expect(exceptionThrown, isFalse);
34 map.put(5, 6, 7, 0);
35 expect(true, isFalse);
36 } catch (e) {
37 exceptionThrown = true;
38 }
39 expect(exceptionThrown, isTrue);
26 40
27 Expect.throws(() => map.put("5", 6, 7, 0), 41 exceptionThrown = false;
28 (e) => true, 42 try {
29 "Invalid key"); 43 expect(exceptionThrown, isFalse);
44 map.put(confuse(), 6, 7, 0);
45 expect(true, isFalse);
46 } catch (e) {
47 exceptionThrown = true;
48 }
49 expect(exceptionThrown, isTrue);
30 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698