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

Side by Side Diff: tests/language_strong/async_await_test.dart

Issue 2765693002: Update all tests (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library async_await_test; 5 library async_await_test;
6 6
7 import "package:unittest/unittest.dart"; 7 import "package:unittest/unittest.dart";
8 import "dart:async"; 8 import "dart:async";
9 9
10 main() { 10 main() {
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 test("top-level getter call", () { 1724 test("top-level getter call", () {
1725 f() async { 1725 f() async {
1726 var a = new Async(); 1726 var a = new Async();
1727 return await a.instanceGetter; 1727 return await a.instanceGetter;
1728 } 1728 }
1729 return expect42(f()); 1729 return expect42(f());
1730 }); 1730 });
1731 1731
1732 if (!checkedMode) return; 1732 if (!checkedMode) return;
1733 1733
1734 test("inside assert, true", () { /// 03: ok 1734 test("inside assert, true", () { //# 03: ok
1735 f() async { /// 03: continued 1735 f() async { //# 03: continued
1736 assert(await new Future.microtask(() => true)); /// 03: continued 1736 assert(await new Future.microtask(() => true)); //# 03: continued
1737 return 42; /// 03: continued 1737 return 42; //# 03: continued
1738 } /// 03: continued 1738 } //# 03: continued
1739 return expect42(f()); /// 03: continued 1739 return expect42(f()); //# 03: continued
1740 }); /// 03: continued 1740 }); //# 03: continued
1741 1741
1742 test("inside assert, false", () { /// 03: continued 1742 test("inside assert, false", () { //# 03: continued
1743 f() async { /// 03: continued 1743 f() async { //# 03: continued
1744 assert(await new Future.microtask(() => false)); /// 03: continued 1744 assert(await new Future.microtask(() => false)); //# 03: continued
1745 return 42; /// 03: continued 1745 return 42; //# 03: continued
1746 } /// 03: continued 1746 } //# 03: continued
1747 return f().then((_) { /// 03: continued 1747 return f().then((_) { //# 03: continued
1748 fail("assert didn't throw"); /// 03: continued 1748 fail("assert didn't throw"); //# 03: continued
1749 }, onError: (e, s) { /// 03: continued 1749 }, onError: (e, s) { //# 03: continued
1750 expect(e is AssertionError, isTrue); /// 03: continued 1750 expect(e is AssertionError, isTrue); //# 03: continued
1751 }); /// 03: continued 1751 }); //# 03: continued
1752 }); /// 03: continued 1752 }); //# 03: continued
1753 1753
1754 test("inside assert, function -> false", () { /// 03: continued 1754 test("inside assert, function -> false", () { //# 03: continued
1755 f() async { /// 03: continued 1755 f() async { //# 03: continued
1756 assert(await new Future.microtask(() => false)); /// 03: continued 1756 assert(await new Future.microtask(() => false)); //# 03: continued
1757 return 42; /// 03: continued 1757 return 42; //# 03: continued
1758 } /// 03: continued 1758 } //# 03: continued
1759 return f().then((_) { /// 03: continued 1759 return f().then((_) { //# 03: continued
1760 fail("assert didn't throw"); /// 03: continued 1760 fail("assert didn't throw"); //# 03: continued
1761 }, onError: (e, s) { /// 03: continued 1761 }, onError: (e, s) { //# 03: continued
1762 expect(e is AssertionError, isTrue); /// 03: continued 1762 expect(e is AssertionError, isTrue); //# 03: continued
1763 }); /// 03: continued 1763 }); //# 03: continued
1764 }); /// 03: continued 1764 }); //# 03: continued
1765 1765
1766 }); 1766 });
1767 1767
1768 group("syntax", () { 1768 group("syntax", () {
1769 test("async as variable", () { 1769 test("async as variable", () {
1770 // Valid identifiers outside of async function. 1770 // Valid identifiers outside of async function.
1771 var async = 42; 1771 var async = 42;
1772 expect(async, equals(42)); 1772 expect(async, equals(42));
1773 }); 1773 });
1774 1774
1775 test("await as variable", () { /// 02: ok 1775 test("await as variable", () { //# 02: ok
1776 // Valid identifiers outside of async function. /// 02: continued 1776 // Valid identifiers outside of async function. //# 02: continued
1777 var await = 42; /// 02: continued 1777 var await = 42; //# 02: continued
1778 expect(await, equals(42)); /// 02: continued 1778 expect(await, equals(42)); //# 02: continued
1779 }); /// 02: continued 1779 }); //# 02: continued
1780 1780
1781 test("yield as variable", () { 1781 test("yield as variable", () {
1782 // Valid identifiers outside of async function. 1782 // Valid identifiers outside of async function.
1783 var yield = 42; 1783 var yield = 42;
1784 expect(yield, equals(42)); 1784 expect(yield, equals(42));
1785 }); 1785 });
1786 }); 1786 });
1787 } 1787 }
1788 1788
1789 1789
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 if (onError is BinaryFunction) { 2002 if (onError is BinaryFunction) {
2003 return onError(_error, null); 2003 return onError(_error, null);
2004 } 2004 }
2005 return onError(_error); 2005 return onError(_error);
2006 }); 2006 });
2007 } 2007 }
2008 Stream asStream() => 2008 Stream asStream() =>
2009 (new StreamController()..addError(_error)..close()).stream; 2009 (new StreamController()..addError(_error)..close()).stream;
2010 Future timeout(Duration duration, {onTimeout()}) => this; 2010 Future timeout(Duration duration, {onTimeout()}) => this;
2011 } 2011 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698