blob: 5c536c9849ac5e8307806ba7490330b9ad20e0f8 [file] [log] [blame]
// Copyright (c) 2011, 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.
/// @assertion final E single
/// Returns the single element in this.
/// @description Checks that the method returns the single element of the queue.
/// Checks that if this is empty or has more than one element throws a StateError.
/// @author kaigorodov
import "dart:collection";
import "../../../Utils/expect.dart";
main() {
DoubleLinkedQueue queue = new DoubleLinkedQueue();
Expect.throws(() { queue.single; }, (e) => e is StateError);
Expect.isTrue(queue.first == 1);
Expect.throws(() { queue.single; }, (e) => e is StateError);