Files
sdk/pkg/kernel/test/binary/library_flags_test.dart
T
Jens Johansen f91ef3afd7 [kernel] Deprecate Library.isExternal
We're deprecating kernels Library.isExternal as it wasn't used for
what it was originally intended. It will hopefully go away entirely
soon.

Change-Id: If363c50af5607febae68865875af452c106fff85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123721
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-11-04 09:24:02 +00:00

48 lines
1.7 KiB
Dart

// Copyright (c) 2019, 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 'utils.dart';
// ignore_for_file: DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE
/// Test that library flags (external, synthetic)
/// are serialized and read correctly.
main() {
Library lib = new Library(Uri.parse("foo://bar.dart"));
lib.isExternal = false;
lib.isSynthetic = false;
Library lib2 = libRoundTrip(lib);
if (lib2.isExternal != false)
throw "Serialized and re-read library had change in external flag.";
if (lib2.isSynthetic != false)
throw "Serialized and re-read library had change in synthetic flag.";
lib = new Library(Uri.parse("foo://bar.dart"));
lib.isExternal = true;
lib.isSynthetic = false;
lib2 = libRoundTrip(lib);
if (lib2.isExternal != true)
throw "Serialized and re-read library had change in external flag.";
if (lib2.isSynthetic != false)
throw "Serialized and re-read library had change in synthetic flag.";
lib = new Library(Uri.parse("foo://bar.dart"));
lib.isExternal = false;
lib.isSynthetic = true;
lib2 = libRoundTrip(lib);
if (lib2.isExternal != false)
throw "Serialized and re-read library had change in external flag.";
if (lib2.isSynthetic != true)
throw "Serialized and re-read library had change in synthetic flag.";
lib = new Library(Uri.parse("foo://bar.dart"));
lib.isExternal = true;
lib.isSynthetic = true;
lib2 = libRoundTrip(lib);
if (lib2.isExternal != true)
throw "Serialized and re-read library had change in external flag.";
if (lib2.isSynthetic != true)
throw "Serialized and re-read library had change in synthetic flag.";
}