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

Unified Diff: pkg/analysis_server/test/typed_mock_test.dart

Issue 251733002: Restore thenReturnList(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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
« no previous file with comments | « pkg/analysis_server/test/typed_mock.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/typed_mock_test.dart
diff --git a/pkg/analysis_server/test/typed_mock_test.dart b/pkg/analysis_server/test/typed_mock_test.dart
index bb609691fa38288ac23c188925a69c6a364a7099..f671541709d3efd8a860cd32e3cf808a63517901 100644
--- a/pkg/analysis_server/test/typed_mock_test.dart
+++ b/pkg/analysis_server/test/typed_mock_test.dart
@@ -87,16 +87,6 @@ main() {
expect(obj.testProperty, 20);
});
- test('thenReturn can replace behavior, method with 1 argument', () {
- TestInterface obj = new TestInterfaceMock();
- when(obj.testMethod1(anyInt)).thenReturn('aaa');
- expect(obj.testMethod1(2), 'aaa');
- expect(obj.testMethod1(3), 'aaa');
- when(obj.testMethod1(anyInt)).thenReturn('bbb');
- expect(obj.testMethod1(2), 'bbb');
- expect(obj.testMethod1(3), 'bbb');
- });
-
test('thenReturn for getter', () {
TestInterface obj = new TestInterfaceMock();
when(obj.testProperty).thenReturn(42);
@@ -164,6 +154,15 @@ main() {
expect(obj.testMethod2('eee', 99), 'everything else');
});
+ test('thenReturnList for getter', () {
+ TestInterface obj = new TestInterfaceMock();
+ when(obj.testProperty).thenReturnList(['a', 'b', 'c']);
+ expect(obj.testProperty, 'a');
+ expect(obj.testProperty, 'b');
+ expect(obj.testProperty, 'c');
+ expect(() => obj.testProperty, throwsA(new isInstanceOf<StateError>()));
+ });
+
test('thenThrow for getter', () {
TestInterface obj = new TestInterfaceMock();
Exception e = new Exception();
« no previous file with comments | « pkg/analysis_server/test/typed_mock.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698