a8e2293752
Conditional exports was never tested through expectation tests. Conditional parts is not fully support yet, but is in the process of being removed from the feature. The added test will show this once parser support is removed. Change-Id: Ibb096a85d5b63d9f35acddff23f61dc31eb2a9c8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452441 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
39 lines
1.2 KiB
Dart
39 lines
1.2 KiB
Dart
// Copyright (c) 2025, 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 'conditional_export_lib1.dart' as a;
|
|
import 'conditional_export_lib2.dart' as b;
|
|
import 'conditional_export_lib3.dart' as c;
|
|
|
|
testA(a.HttpRequest request) {
|
|
request.certificate; // Error (from dart:io)
|
|
request.response; // Ok (from dart:io and dart:html)
|
|
request.readyState; // Ok (from dart:html)
|
|
request.hashCode; // Ok
|
|
}
|
|
|
|
testB(b.HttpRequest request) {
|
|
request.certificate; // Error (from dart:io)
|
|
request.response; // Ok (from dart:io and dart:html)
|
|
request.readyState; // Ok (from dart:html)
|
|
request.hashCode; // Ok
|
|
}
|
|
|
|
testC(c.HttpRequest request) {
|
|
request.certificate; // Error
|
|
request.response; // Error
|
|
request.readyState; // Error
|
|
request.hashCode; // Ok
|
|
}
|
|
|
|
void main() {
|
|
expect(false, const bool.fromEnvironment("dart.library.io"));
|
|
expect(true, const bool.fromEnvironment("dart.library.html"));
|
|
expect(false, const bool.fromEnvironment("dart.library.foo"));
|
|
}
|
|
|
|
expect(expected, actual) {
|
|
if (expected != actual) throw 'Expected $expected, actual $actual';
|
|
}
|