// Copyright (c) 2018, 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. // @dart = 2.9 import 'package:_fe_analyzer_shared/src/util/link.dart' show Link, LinkBuilder; import 'package:expect/expect.dart' show Expect; main() { Link strings = const Link().prepend("B").prepend("A"); Expect.stringEquals("[ A, B ]", "${strings}"); Expect.stringEquals("[ B, A ]", "${strings.reverse(const Link())}"); strings = (new LinkBuilder()..addLast("A")..addLast("B")) .toLink(const Link()); Expect.stringEquals("[ A, B ]", "${strings}"); Expect.stringEquals("[ B, A ]", "${strings.reverse(const Link())}"); strings = new LinkBuilder() .toLink(const Link()) .prepend("B") .prepend("A"); Expect.stringEquals("[ A, B ]", "${strings}"); Expect.stringEquals("[ B, A ]", "${strings.reverse(const Link())}"); strings = const Link() .reverse(const Link()) .prepend("B") .prepend("A"); Expect.stringEquals("[ A, B ]", "${strings}"); Expect.stringEquals("[ B, A ]", "${strings.reverse(const Link())}"); strings = (new LinkBuilder()..addLast("A")..addLast("B")) .toLink(const Link()); Expect.stringEquals("[ A, B ]", "${strings}"); Expect.stringEquals("[ B, A ]", "${strings.reverse(const Link())}"); Link ints = const Link().prepend(1).reverse(const Link()).tail.prepend(1); Expect.stringEquals("[ 1 ]", "${ints}"); }