439cabaec0
These changes are not sufficient by themselves, but the subset that can still run in Dart 2. Bug: https://github.com/dart-lang/sdk/issues/40045 Change-Id: Ie8f61fc9ee94b85329a701f97b5d3f91dbc1f889 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132422 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Siva Annamalai <asiva@google.com> Reviewed-by: Ben Konyi <bkonyi@google.com>
36 lines
1.2 KiB
Dart
36 lines
1.2 KiB
Dart
// Copyright (c) 2013, 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.
|
|
|
|
library test.libraries_test;
|
|
|
|
import 'dart:mirrors';
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
main() {
|
|
MirrorSystem mirrors = currentMirrorSystem();
|
|
Expect.isNotNull(mirrors, 'mirrors is null');
|
|
|
|
Map<Uri, LibraryMirror> libraries = mirrors.libraries;
|
|
Expect.isNotNull(libraries, 'libraries is null');
|
|
|
|
Expect.isTrue(libraries.isNotEmpty);
|
|
LibraryMirror mirrorsLibrary = libraries[Uri.parse('dart:mirrors')];
|
|
if (mirrorsLibrary == null) {
|
|
// In minified mode we don't preserve the URIs.
|
|
mirrorsLibrary = libraries.values
|
|
.firstWhere((LibraryMirror lm) => lm.simpleName == #dart.mirrors);
|
|
Uri uri = mirrorsLibrary.uri;
|
|
Expect.equals("https", uri.scheme);
|
|
Expect.equals("dartlang.org", uri.host);
|
|
Expect.equals("/dart2js-stripped-uri", uri.path);
|
|
}
|
|
|
|
ClassMirror cls = mirrorsLibrary.declarations[#LibraryMirror] as ClassMirror;
|
|
Expect.isNotNull(cls, 'cls is null');
|
|
|
|
Expect.equals(#dart.mirrors.LibraryMirror, cls.qualifiedName);
|
|
Expect.equals(reflectClass(LibraryMirror), cls);
|
|
}
|