Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
|
Ivan Posva
2012/01/10 00:28:09
.
Mads Ager (google)
2012/01/10 06:55:05
Done.
| |
| 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 | |
| 7 #include "platform/globals.h" | 6 #include "platform/globals.h" |
| 8 | |
| 9 #include "vm/assert.h" | 7 #include "vm/assert.h" |
| 10 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
| 11 | 9 |
| 12 | 10 |
| 13 // 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 |
| 14 // directory, or the top directory. | 12 // directory, or the top directory. |
| 15 static const char* GetFileName(const char* name) { | 13 static const char* GetFileName(const char* name) { |
| 16 if (File::Exists(name)) { | 14 if (File::Exists(name)) { |
| 17 return name; | 15 return name; |
| 18 } else { | 16 } else { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 const char* kFilename = | 50 const char* kFilename = |
| 53 GetFileName("runtime/tests/vm/data/fixed_length_file"); | 51 GetFileName("runtime/tests/vm/data/fixed_length_file"); |
| 54 File* file = File::Open(kFilename, File::kRead); | 52 File* file = File::Open(kFilename, File::kRead); |
| 55 EXPECT(file != NULL); | 53 EXPECT(file != NULL); |
| 56 EXPECT(file->ReadFully(buf, 12)); | 54 EXPECT(file->ReadFully(buf, 12)); |
| 57 EXPECT_EQ(12, file->Position()); | 55 EXPECT_EQ(12, file->Position()); |
| 58 EXPECT(file->ReadFully(buf, 6)); | 56 EXPECT(file->ReadFully(buf, 6)); |
| 59 EXPECT_EQ(18, file->Position()); | 57 EXPECT_EQ(18, file->Position()); |
| 60 delete file; | 58 delete file; |
| 61 } | 59 } |
| OLD | NEW |