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

Unified Diff: tests/language_strong/type_variable_bounds4_test.dart

Issue 3007803002: Migrate block 162 to Dart 2.0.
Patch Set: Created 3 years, 4 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
Index: tests/language_strong/type_variable_bounds4_test.dart
diff --git a/tests/language_strong/type_variable_bounds4_test.dart b/tests/language_strong/type_variable_bounds4_test.dart
deleted file mode 100644
index 46a154cfd6023b2d8570d83c61500ef13c6f7850..0000000000000000000000000000000000000000
--- a/tests/language_strong/type_variable_bounds4_test.dart
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Test instantiation of object with malbounded types.
-
-class A<
- T
- extends num //# 01: static type warning
- > {}
-
-class B<T> implements A<T> {}
-
-class C<
- T
- extends num //# 01: continued
- > implements B<T> {}
-
-class Class<T> {
- newA() {
- new A<T>(); //# 01: continued
- }
- newB() {
- new B<T>(); //# 01: continued
- }
- newC() {
- new C<T>(); //# 01: continued
- }
-}
-
-bool inCheckedMode() {
- try {
- var i = 42;
- String s = i;
- } on TypeError catch (e) {
- return true;
- }
- return false;
-}
-
-void test(bool expectTypeError, f()) {
- try {
- var v = f();
- if (expectTypeError && inCheckedMode()) {
- throw 'Missing type error instantiating ${v.runtimeType}';
- }
- } on TypeError catch (e) {
- if (!expectTypeError || !inCheckedMode()) {
- throw 'Unexpected type error: $e';
- }
- }
-}
-
-void main() {
- test(false, () => new A<int>());
- test(false, () => new B<int>());
- test(false, () => new C<int>());
-
- test(true, () => new A<String>()); //# 01: continued
- test(true, () => new B<String>()); //# 01: continued
- test(true, () => new C<String>()); //# 01: continued
-
- var c = new Class<int>();
- test(false, () => c.newA());
- test(false, () => c.newB());
- test(false, () => c.newC());
-
- c = new Class<String>();
- test(true, () => c.newA()); //# 01: continued
- test(true, () => c.newB()); //# 01: continued
- test(true, () => c.newC()); //# 01: continued
-}

Powered by Google App Engine
This is Rietveld 408576698