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 #include "bin/file.h" | 5 #include "bin/file.h" |
| 6 #include "platform/assert.h" |
6 #include "platform/globals.h" | 7 #include "platform/globals.h" |
7 #include "vm/assert.h" | |
8 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
9 | 9 |
10 | 10 |
11 // Helper method to be able to run the test from the runtime | 11 // Helper method to be able to run the test from the runtime |
12 // directory, or the top directory. | 12 // directory, or the top directory. |
13 static const char* GetFileName(const char* name) { | 13 static const char* GetFileName(const char* name) { |
14 if (File::Exists(name)) { | 14 if (File::Exists(name)) { |
15 return name; | 15 return name; |
16 } else { | 16 } else { |
17 static const int kRuntimeLength = strlen("runtime/"); | 17 static const int kRuntimeLength = strlen("runtime/"); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 const char* kFilename = | 50 const char* kFilename = |
51 GetFileName("runtime/tests/vm/data/fixed_length_file"); | 51 GetFileName("runtime/tests/vm/data/fixed_length_file"); |
52 File* file = File::Open(kFilename, File::kRead); | 52 File* file = File::Open(kFilename, File::kRead); |
53 EXPECT(file != NULL); | 53 EXPECT(file != NULL); |
54 EXPECT(file->ReadFully(buf, 12)); | 54 EXPECT(file->ReadFully(buf, 12)); |
55 EXPECT_EQ(12, file->Position()); | 55 EXPECT_EQ(12, file->Position()); |
56 EXPECT(file->ReadFully(buf, 6)); | 56 EXPECT(file->ReadFully(buf, 6)); |
57 EXPECT_EQ(18, file->Position()); | 57 EXPECT_EQ(18, file->Position()); |
58 delete file; | 58 delete file; |
59 } | 59 } |
OLD | NEW |