OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library TypedArrays1Test; | |
6 import 'package:unittest/unittest.dart'; | |
7 import 'package:unittest/html_individual_config.dart'; | |
8 import 'dart:html'; | 5 import 'dart:html'; |
9 import 'dart:typed_data'; | 6 import 'dart:typed_data'; |
10 | 7 |
| 8 import 'package:expect/minitest.dart'; |
| 9 |
11 main() { | 10 main() { |
12 useHtmlIndividualConfiguration(); | 11 var isList = predicate((x) => x is List, 'is a List'); |
13 | 12 var isNumList = predicate((x) => x is List<num>, 'is a List<num>'); |
14 var isnumList = predicate((x) => x is List<num>, 'is a List<num>'); | 13 var isNotStringList = |
15 var isStringList = predicate((x) => x is List<String>, 'is a List<String>'); | 14 predicate((x) => x is! List<String>, 'is not a List<String>'); |
16 var expectation = Platform.supportsTypedData ? returnsNormally : throws; | 15 var expectation = Platform.supportsTypedData ? returnsNormally : throws; |
17 | 16 |
18 group('supported', () { | 17 group('supported', () { |
19 test('supported', () { | 18 test('supported', () { |
20 expect(Platform.supportsTypedData, true); | 19 expect(Platform.supportsTypedData, true); |
21 }); | 20 }); |
22 }); | 21 }); |
23 | 22 |
24 group('arrays', () { | 23 group('arrays', () { |
25 test('createByLengthTest', () { | 24 test('createByLengthTest', () { |
(...skipping 30 matching lines...) Expand all Loading... |
56 | 55 |
57 // Generic type checking is not available in dart2js, so use this check to | 56 // Generic type checking is not available in dart2js, so use this check to |
58 // see if we should check for it. | 57 // see if we should check for it. |
59 var supportsTypeTest = !(new List<String>() is List<int>); | 58 var supportsTypeTest = !(new List<String>() is List<int>); |
60 | 59 |
61 if (supportsTypeTest) { | 60 if (supportsTypeTest) { |
62 test('typeTests', () { | 61 test('typeTests', () { |
63 expect(() { | 62 expect(() { |
64 var a = new Float32List(10); | 63 var a = new Float32List(10); |
65 expect(a, isList); | 64 expect(a, isList); |
66 expect(a, isnumList); | 65 expect(a, isNumList); |
67 expect(a, isNot(isStringList)); | 66 expect(a, isNotStringList); |
68 }, expectation); | 67 }, expectation); |
69 }); | 68 }); |
70 } | 69 } |
71 }); | 70 }); |
72 } | 71 } |
OLD | NEW |