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

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

Issue 2737933002: Add tests for generic methods in strong mode (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
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
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.
4
5 library generic_methods_optional_parameters_test;
6
7 import "package:expect/expect.dart";
8
9 typedef FunObjObj = Object Function<T>(Object, {Object y});
10 typedef FunTypObj = Object Function<T>(T, {Object y});
11 typedef FunObjTyp = Object Function<T>(Object, {T y});
12 typedef FunTypTyp = Object Function<T>(T, {T y});
13
14 Object funObjObj<T>(Object x, {Object y}) => x;
15 Object funTypObj<T>(T x, {Object y}) => y;
16 Object funObjTyp<T>(Object x, {T y}) => x;
17 Object funTypTyp<T>(T x, {T y}) => null;
18
19 main() {
20 Expect.isTrue(funObjObj is FunObjObj);
Leaf 2017/03/09 05:51:19 Any reason not to also assert here that funObjObj
Dmitry Stefantsov 2017/03/10 13:21:54 None at all :) Thanks! Also added checks for othe
21
22 Expect.isTrue(funTypObj is FunTypObj);
23 Expect.isTrue(funTypObj is! FunObjObj);
eernst 2017/03/09 14:55:02 Similarly here and below: Might as well have is/is
Dmitry Stefantsov 2017/03/10 13:21:54 Agreed and done.
24
25 Expect.isTrue(funObjTyp is FunObjTyp);
26 Expect.isTrue(funObjTyp is! FunObjObj);
27
28 Expect.isTrue(funTypTyp is FunTypTyp);
29 Expect.isTrue(funTypTyp is! FunTypObj);
30 Expect.isTrue(funTypTyp is! FunObjTyp);
31 Expect.isTrue(funTypTyp is! FunObjObj);
32 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698