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

Unified Diff: tests/corelib/list_first_test.dart

Issue 11316059: Add List.first. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add dart2js interceptor and add test. Created 8 years, 1 month 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 | « sdk/lib/svg/dartium/svg_dartium.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 []);
}
« no previous file with comments | « sdk/lib/svg/dartium/svg_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698