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

Unified Diff: tests/html/typed_arrays_arraybuffer_test.dart

Issue 14367012: Move to new dart:typeddata types for dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revert generated files for html lib Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: tests/html/typed_arrays_arraybuffer_test.dart
diff --git a/tests/html/typed_arrays_arraybuffer_test.dart b/tests/html/typed_arrays_arraybuffer_test.dart
index 1a2bd2136ba6b83b7d9403680a81bf24ebd9be3b..dc36cbc83659fb3b1980c59e624f78287d4a2a27 100644
--- a/tests/html/typed_arrays_arraybuffer_test.dart
+++ b/tests/html/typed_arrays_arraybuffer_test.dart
@@ -6,6 +6,7 @@ library typed_arrays_arraybuffer_test;
import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_config.dart';
import 'dart:html';
+import 'dart:typeddata';
main() {
useHtmlConfiguration();
@@ -16,31 +17,28 @@ main() {
}
test('constructor', () {
- var a = new ArrayBuffer(100);
- expect(a.byteLength, 100);
+ var a = new Int8List(100);
+ expect(a.lengthInBytes, 100);
});
- test('slice1', () {
- var a = new ArrayBuffer(100);
- var s = a.slice(10, 40);
- expect(s.byteLength, 30);
+ test('sublist1', () {
+ var a = new Int8List(100);
+ var s = a.sublist(10, 40);
+ expect(s.length, 30);
});
- test('slice2', () {
- var a = new ArrayBuffer(100);
- var s = a.slice(10, 400);
- expect(s.byteLength, 90); // indexes clamped to valid range.
+ test('sublist2', () {
+ var a = new Int8List(100);
+ expect(() => a.sublist(10, 400), throwsRangeError);
});
- test('slice3', () {
- var a = new ArrayBuffer(100);
- var s = a.slice(50, 10);
- expect(s.byteLength, 0); // end before start becomes empty range.
+ test('sublist3', () {
+ var a = new Int8List(100);
+ expect(() => a.sublist(50, 10), throwsRangeError);
});
- test('slice4', () {
- var a = new ArrayBuffer(100);
- var s = a.slice(-90, -30);
- expect(s.byteLength, 60); // negative indexes measure from end.
+ test('sublist4', () {
+ var a = new Int8List(100);
+ expect(() => a.sublist(-90, -30), throwsRangeError);
});
}

Powered by Google App Engine
This is Rietveld 408576698