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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/observatory/tests/service/library_dependency_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/tests/service/address_mapper_test.dart
diff --git a/runtime/observatory/tests/service/address_mapper_test.dart b/runtime/observatory/tests/service/address_mapper_test.dart
index b0534932a072301e73fcd53d9566cfd46c499d6d..05fbf368437155504685ffa17a0a27568930c988 100644
--- a/runtime/observatory/tests/service/address_mapper_test.dart
+++ b/runtime/observatory/tests/service/address_mapper_test.dart
@@ -4,27 +4,52 @@
// VMOptions=--compile_all --error_on_bad_type --error_on_bad_override
import 'package:observatory/object_graph.dart';
-import 'package:expect/expect.dart';
+import 'package:unittest/unittest.dart';
+
+dynamic confuse() {
+ if (true) {
+ return "5";
+ }
+ return 5;
+}
main() {
var map = new AddressMapper(42);
- Expect.equals(null, map.get(1, 2, 3));
- Expect.equals(4, map.put(1, 2, 3, 4));
- Expect.equals(4, map.get(1, 2, 3));
+ expect(map.get(1, 2, 3), isNull);
+ expect(map.put(1, 2, 3, 4), equals(4));
+ expect(map.get(1, 2, 3), equals(4));
- Expect.equals(null, map.get(2, 3, 1));
- Expect.equals(null, map.get(3, 1, 2));
+ expect(map.get(2, 3, 1), isNull);
+ expect(map.get(3, 1, 2), isNull);
- Expect.throws(() => map.put(1, 2, 3, 44),
- (e) => true,
- "Overwrite key");
+ bool exceptionThrown = false;
+ try {
+ expect(exceptionThrown, isFalse);
+ map.put(1, 2, 3, 44);
+ expect(true, isFalse);
+ } catch (e) {
+ exceptionThrown = true;
+ }
+ expect(exceptionThrown, isTrue);
- Expect.throws(() => map.put(5, 6, 7, 0),
- (e) => true,
- "Invalid value");
+ exceptionThrown = false;
+ try {
+ expect(exceptionThrown, isFalse);
+ map.put(5, 6, 7, 0);
+ expect(true, isFalse);
+ } catch (e) {
+ exceptionThrown = true;
+ }
+ expect(exceptionThrown, isTrue);
- Expect.throws(() => map.put("5", 6, 7, 0),
- (e) => true,
- "Invalid key");
+ exceptionThrown = false;
+ try {
+ expect(exceptionThrown, isFalse);
+ map.put(confuse(), 6, 7, 0);
+ expect(true, isFalse);
+ } catch (e) {
+ exceptionThrown = true;
+ }
+ expect(exceptionThrown, isTrue);
}
« 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