Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Side by Side Diff: packages/quiver/test/collection/delegates/queue_test.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 Google Inc. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 library quiver.collection.delegates.queue_test;
16
17 import 'dart:collection' show Queue;
18
19 import 'package:quiver/collection.dart';
20 import 'package:test/test.dart';
21
22 class MyQueue extends DelegatingQueue<String> {
23 final Queue<String> _delegate;
24
25 MyQueue(this._delegate);
26
27 Queue<String> get delegate => _delegate;
28 }
29
30 void main() {
31 group('DelegatingQueue', () {
32 DelegatingQueue<String> delegatingQueue;
33
34 setUp(() {
35 delegatingQueue = new MyQueue(new Queue<String>.from(['a', 'b', 'cc']));
36 });
37
38 test('add', () {
39 delegatingQueue.add('d');
40 expect(delegatingQueue, equals(['a', 'b', 'cc', 'd']));
41 });
42
43 test('addAll', () {
44 delegatingQueue.addAll(['d', 'e']);
45 expect(delegatingQueue, equals(['a', 'b', 'cc', 'd', 'e']));
46 });
47
48 test('addFirst', () {
49 delegatingQueue.addFirst('d');
50 expect(delegatingQueue, equals(['d', 'a', 'b', 'cc']));
51 });
52
53 test('addLast', () {
54 delegatingQueue.addLast('d');
55 expect(delegatingQueue, equals(['a', 'b', 'cc', 'd']));
56 });
57
58 test('clear', () {
59 delegatingQueue.clear();
60 expect(delegatingQueue, equals([]));
61 });
62
63 test('remove', () {
64 expect(delegatingQueue.remove('b'), isTrue);
65 expect(delegatingQueue, equals(['a', 'cc']));
66 });
67
68 test('removeFirst', () {
69 expect(delegatingQueue.removeFirst(), 'a');
70 expect(delegatingQueue, equals(['b', 'cc']));
71 });
72
73 test('removeLast', () {
74 expect(delegatingQueue.removeLast(), 'cc');
75 expect(delegatingQueue, equals(['a', 'b']));
76 });
77 });
78 }
OLDNEW
« no previous file with comments | « packages/quiver/test/collection/delegates/map_test.dart ('k') | packages/quiver/test/collection/delegates/set_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698