2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
- // VMOptions=--reify-generic-functions
5
+ // TODO(37452): Avoid using unspecified 'toString' behaviour in language test.
6
6
7
7
import 'package:expect/expect.dart' ;
8
8
@@ -25,11 +25,34 @@ class C<T> {
25
25
}
26
26
27
27
main () {
28
- Expect .equals ("(<F>(F) => F) => void" , foo.runtimeType.toString ());
29
- Expect .equals ("<B>(<F>(F) => B) => B" , bar.runtimeType.toString ());
30
- Expect .equals ("<F>(F) => int" , baz <int >().runtimeType.toString ());
28
+ expectOne (
29
+ foo.runtimeType.toString (),
30
+ ["(<F>(F) => F) => void" , "(<T1>(T1) => T1) => void" ],
31
+ );
32
+ expectOne (
33
+ bar.runtimeType.toString (),
34
+ ["<B>(<F>(F) => B) => B" , "<T1>(<T2>(T2) => T1) => T1" ],
35
+ );
36
+ expectOne (
37
+ baz <int >().runtimeType.toString (),
38
+ ["<F>(F) => int" , "<T1>(T1) => int" ],
39
+ );
40
+
31
41
var c = new C <bool >();
32
- Expect .equals ("(<F>(bool, F) => F) => void" , c.foo.runtimeType.toString ());
33
- Expect .equals ("<B>(<F>(bool, F) => B) => B" , c.bar.runtimeType.toString ());
34
- Expect .equals ("<F>(bool, F) => int" , c.baz <int >().runtimeType.toString ());
42
+ expectOne (
43
+ c.foo.runtimeType.toString (),
44
+ ["(<F>(bool, F) => F) => void" , "(<T1>(bool, T1) => T1) => void" ],
45
+ );
46
+ expectOne (
47
+ c.bar.runtimeType.toString (),
48
+ ["<B>(<F>(bool, F) => B) => B" , "<T1>(<T2>(bool, T2) => T1) => T1" ],
49
+ );
50
+ expectOne (
51
+ c.baz <int >().runtimeType.toString (),
52
+ ["<F>(bool, F) => int" , "<T1>(bool, T1) => int" ],
53
+ );
54
+ }
55
+
56
+ expectOne (String name, Iterable <String > names) {
57
+ Expect .isTrue (names.contains (name), '"$name " should be one of: ${names }' );
35
58
}
0 commit comments