Files
sdk/tests/language_2/named_parameters_passing_false_test.dart
T
pq 8da668be93 Migrate Test Block 137 to Dart 2.0.
named_parameters_default_eq_test .. namer_test

Bug:
Change-Id: I0d0d853e94e7ca78472224405f811d1ac55c1f6c
Reviewed-on: https://dart-review.googlesource.com/5283
Reviewed-by: Ben Konyi <bkonyi@google.com>
2017-09-13 15:44:13 +00:00

47 lines
1.5 KiB
Dart

// Copyright (c) 2011, 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.
import "package:expect/expect.dart";
// Dart test program for testing named parameters with 'false' passed as an
// argument.
class TestClass {
TestClass();
bool method([bool value]) => value;
bool method2({bool value}) => value;
static bool staticMethod([bool value]) => value;
static bool staticMethod2({bool value}) => value;
}
bool globalMethod([bool value]) => value;
bool globalMethod2({bool value}) => value;
main() {
var obj = new TestClass();
Expect.equals(null, obj.method());
Expect.equals(null, obj.method2());
Expect.equals(true, obj.method(true));
Expect.equals(true, obj.method2(value: true));
Expect.equals(false, obj.method(false));
Expect.equals(false, obj.method2(value: false));
Expect.equals(null, TestClass.staticMethod());
Expect.equals(null, TestClass.staticMethod2());
Expect.equals(true, TestClass.staticMethod(true));
Expect.equals(true, TestClass.staticMethod2(value: true));
Expect.equals(false, TestClass.staticMethod(false));
Expect.equals(false, TestClass.staticMethod2(value: false));
Expect.equals(null, globalMethod());
Expect.equals(null, globalMethod2());
Expect.equals(true, globalMethod(true));
Expect.equals(true, globalMethod2(value: true));
Expect.equals(false, globalMethod(false));
Expect.equals(false, globalMethod2(value: false));
}