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

Side by Side Diff: tests/standalone/io/read_into_const_list_test.dart

Issue 14018007: Rename RandomAccessFile.readList and RandomAccessFile.writeList to RandomAccessFile.readInto and Ra… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Regression test for missing immutability check in the ListSet 5 // Regression test for missing immutability check in the ListSet
6 // methods in the API. This allowed overwriting const Lists. 6 // methods in the API. This allowed overwriting const Lists.
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import "dart:io"; 9 import "dart:io";
10 10
11 String getFilename(String path) => 11 String getFilename(String path) =>
12 new File(path).existsSync() ? path : 'runtime/$path'; 12 new File(path).existsSync() ? path : 'runtime/$path';
13 13
14 void main() { 14 void main() {
15 var a = const [0]; 15 var a = const [0];
16 var b = const [0]; 16 var b = const [0];
17 Expect.identical(a, b); 17 Expect.identical(a, b);
18 18
19 String filename = getFilename("bin/file_test.cc"); 19 String filename = getFilename("bin/file_test.cc");
20 File file = new File(filename); 20 File file = new File(filename);
21 file.open().then((input) { 21 file.open().then((input) {
22 try { 22 try {
23 input.readListSync(a, 0, 1); 23 input.readIntoSync(a, 0, 1);
24 Expect.fail("no exception thrown"); 24 Expect.fail("no exception thrown");
25 } catch (e) { 25 } catch (e) {
26 Expect.isTrue(e is UnsupportedError); 26 Expect.isTrue(e is UnsupportedError);
27 } 27 }
28 Expect.equals(0, a[0]); 28 Expect.equals(0, a[0]);
29 Expect.equals(0, b[0]); 29 Expect.equals(0, b[0]);
30 }); 30 });
31 } 31 }
OLDNEW
« no previous file with comments | « tests/standalone/io/file_typed_data_test.dart ('k') | tests/standalone/io/stream_pipe_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698