Index: tests/corelib/list_first_test.dart |
diff --git a/tests/language/field_type_check2_test.dart b/tests/corelib/list_first_test.dart |
similarity index 54% |
copy from tests/language/field_type_check2_test.dart |
copy to tests/corelib/list_first_test.dart |
index 80925f4f7d4d307073a8c4634a9bd1b90c2e0c41..cdd718be90ee742f5e1a610a03ebca1a280e0129 100644 |
--- a/tests/language/field_type_check2_test.dart |
+++ b/tests/corelib/list_first_test.dart |
@@ -2,19 +2,17 @@ |
// 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. |
-class A { |
- A a; |
- |
- bar(c) { |
- c.a = 2; /// 01: dynamic type error |
+void test(List list) { |
+ if (list.isEmpty) { |
+ Expect.throws(() => list.first, (e) => e is RangeError); |
+ } else { |
+ Expect.equals(list[0], list.first); |
} |
} |
-class B { |
- int a; |
-} |
- |
main() { |
- new A().bar(new A()); /// 01: continued |
- new A().bar(new B()); |
+ test([1, 2, 3]); |
+ test(const ["foo", "bar"]); |
+ test([]); |
+ test(const []); |
} |