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

Unified Diff: test/codegen/corelib/list_last_test.dart

Issue 1945153002: Add corelib tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: error_test and range_error_test now pass Created 4 years, 7 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: test/codegen/corelib/list_last_test.dart
diff --git a/test/codegen/language/interceptor3_test.dart b/test/codegen/corelib/list_last_test.dart
similarity index 54%
copy from test/codegen/language/interceptor3_test.dart
copy to test/codegen/corelib/list_last_test.dart
index a12172187ec342dba67ad1898a14b91c0aef9479..07333356b2ebcac84eff23085702c663971a6023 100644
--- a/test/codegen/language/interceptor3_test.dart
+++ b/test/codegen/corelib/list_last_test.dart
@@ -4,14 +4,17 @@
import "package:expect/expect.dart";
-// Test that code motion in the presence of interceptors work in dart2js.
-
-main() {
- var a = [2, '2'];
- var b = a[1];
- if (a[0] == 2 && b is String) {
- Expect.isTrue(b.contains('2'));
+void test(List list) {
+ if (list.isEmpty) {
+ Expect.throws(() => list.last, (e) => e is StateError);
} else {
- b.isEven();
+ Expect.equals(list[list.length - 1], list.last);
}
}
+
+main() {
+ test([1, 2, 3]);
+ test(const ["foo", "bar"]);
+ test([]);
+ test(const []);
+}
« no previous file with comments | « test/codegen/corelib/list_iterators_test.dart ('k') | test/codegen/corelib/list_literal_is_growable_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698