Remove isDart2 utility (#132)
We no longer run tests on Dart 1 SDKs so we don't need to have
workarounds for behavior differences.
diff --git a/test/queue_list_test.dart b/test/queue_list_test.dart
index a47e862..4814550 100644
--- a/test/queue_list_test.dart
+++ b/test/queue_list_test.dart
@@ -5,8 +5,6 @@
import 'package:collection/collection.dart';
import 'package:test/test.dart';
-import 'utils.dart';
-
void main() {
group('QueueList()', () {
test('creates an empty QueueList', () {
@@ -257,18 +255,10 @@
var patternQueue = QueueList<Pattern>()..addAll(['a', 'b']);
var stringQueue = patternQueue.cast<String>();
stringQueue.addAll(['c', 'd']);
- expect(
- stringQueue,
- const TypeMatcher<QueueList<String>>(),
- reason: 'Expected QueueList<String>, got ${stringQueue.runtimeType}',
- skip: isDart2 ? false : 'Cast does nothing in Dart1',
- );
+ expect(stringQueue, const TypeMatcher<QueueList<String>>(),
+ reason: 'Expected QueueList<String>, got ${stringQueue.runtimeType}');
- expect(
- stringQueue,
- ['a', 'b', 'c', 'd'],
- skip: isDart2 ? false : 'Cast does nothing in Dart1',
- );
+ expect(stringQueue, ['a', 'b', 'c', 'd']);
expect(patternQueue, stringQueue, reason: 'Should forward to original');
});
@@ -276,18 +266,12 @@
test('cast throws on mutation when the type is not valid', () {
QueueList<Object> stringQueue = QueueList<String>();
var numQueue = stringQueue.cast<num>();
+ expect(numQueue, const TypeMatcher<QueueList<num>>(),
+ reason: 'Expected QueueList<num>, got ${numQueue.runtimeType}');
expect(
- numQueue,
- const TypeMatcher<QueueList<num>>(),
- reason: 'Expected QueueList<num>, got ${numQueue.runtimeType}',
- skip: isDart2 ? false : 'Cast does nothing in Dart1',
- );
- expect(
- () => numQueue.add(1),
- // ignore: deprecated_member_use
- throwsA(isA<CastError>()),
- skip: isDart2 ? false : 'In Dart1 a TypeError is not thrown',
- );
+ () => numQueue.add(1),
+ // ignore: deprecated_member_use
+ throwsA(isA<CastError>()));
});
test('cast returns a new QueueList', () {
diff --git a/test/utils.dart b/test/utils.dart
deleted file mode 100644
index 2c80fe2..0000000
--- a/test/utils.dart
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) 2016, 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.
-
-/// A hack to determine whether we are running in a Dart 2 runtime.
-final bool isDart2 = _isTypeArgString('');
-bool _isTypeArgString<T>(T arg) {
- try {
- return T == String;
- } catch (_) {
- return false;
- }
-}