mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:27:17 +00:00
3a7eeb6315
Change-Id: If3912d75c5f89a741299b2fae4299d01ac928eec Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170424 Reviewed-by: Lasse R.H. Nielsen <lrn@google.com> Reviewed-by: Michael Thomsen <mit@google.com> Reviewed-by: Mayank Patke <fishythefish@google.com> Commit-Queue: Erik Ernst <eernst@google.com>
25 lines
862 B
Dart
25 lines
862 B
Dart
// Copyright (c) 2020, 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';
|
|
|
|
main() {
|
|
const trueInNoSoundMode = <Null>[] is List<int>;
|
|
Expect.equals(hasUnsoundNullSafety, trueInNoSoundMode);
|
|
|
|
// The following tests use the Uri.pathSegments() to access a constant list
|
|
// that is defined in the SDK and verify the type associated with it does not
|
|
// allow null when running with sound null safety.
|
|
var emptyUri = Uri(pathSegments: []);
|
|
dynamic stringList = emptyUri.pathSegments.toList();
|
|
if (hasSoundNullSafety) {
|
|
Expect.throwsTypeError(() {
|
|
stringList.add(null);
|
|
});
|
|
} else {
|
|
stringList.add(null);
|
|
Expect.listEquals([null], stringList);
|
|
}
|
|
}
|