blob: 610baab08be82b27a94cf75f62547c1ff959104d [file] [log] [blame]
 // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. // Dart test program to test arithmetic operations. import "dart:async"; import "package:expect/expect.dart"; class B {} class C implements Function { B call(B b) => b; } typedef B BToB(B x); typedef Object NullToObject(Null x); C c = new C(); void check1(BToB f) { Expect.isFalse(identical(c, f)); Expect.equals(c.call, f); B b = new B(); Expect.identical(f(b), b); } void check2(FutureOr f) { Expect.isFalse(identical(c, f)); Expect.equals(c.call, f); BToB f2 = f; B b = new B(); Expect.identical(f2(b), b); } void check3(NullToObject f) { Expect.isFalse(identical(c, f)); Expect.equals(c.call, f); Expect.isNull(f(null)); } void check4(FutureOr f) { Expect.isFalse(identical(c, f)); Expect.equals(c.call, f); NullToObject f2 = f; Expect.isNull(f2(null)); } void check5(Function f) { Expect.isFalse(identical(c, f)); Expect.equals(c.call, f); B b = new B(); Expect.identical(f(b), b); } void check6(FutureOr f) { Expect.isFalse(identical(c, f)); Expect.equals(c.call, f); B b = new B(); Function f2 = f; Expect.identical(f2(b), b); } void check7(C x) { Expect.identical(c, x); } void check8(FutureOr x) { Expect.identical(c, x); } void check9(Object o) { Expect.identical(c, o); } void check10(FutureOr