Index: runtime/tests/vm/dart/hello_fuchsia_test.dart |
diff --git a/runtime/tests/vm/dart/hello_fuchsia_test.dart b/runtime/tests/vm/dart/hello_fuchsia_test.dart |
index ce9cd7da7fe07ea3b22ca17885b71472a80364d1..1acd69796306cd658fcae5adb8b5d0ab3b7258c8 100644 |
--- a/runtime/tests/vm/dart/hello_fuchsia_test.dart |
+++ b/runtime/tests/vm/dart/hello_fuchsia_test.dart |
@@ -403,6 +403,25 @@ void testPlatformEnvironment() { |
} |
} |
+Future testCopy() async { |
+ final String sourceName = "foo"; |
+ final String destName = "bar"; |
+ Directory tmp = await Directory.systemTemp.createTemp("testCopy"); |
+ File sourceFile = new File("${tmp.path}/$sourceName"); |
+ File destFile = new File("${tmp.path}/$destName"); |
+ List<int> data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; |
siva
2016/12/20 00:04:22
I think we should make this data bigger (potential
zra
2016/12/20 17:43:58
Changed to 10KB.
|
+ await sourceFile.writeAsBytes(data); |
+ await sourceFile.copy(destFile.path); |
+ List<int> resultData = await destFile.readAsBytes(); |
+ assert(data.length == resultData.length); |
+ for (int i = 0; i < data.length; i++) { |
+ assert(data[i] == resultData[i]); |
+ } |
+ await sourceFile.delete(); |
+ await destFile.delete(); |
+ await tmp.delete(); |
+} |
+ |
main() async { |
print("Hello, Fuchsia!"); |
@@ -446,5 +465,9 @@ main() async { |
await testProcess(); |
print("testProcess done"); |
+ print("testCopy"); |
+ await testCopy(); |
+ print("testCopy done"); |
+ |
print("Goodbyte, Fuchsia!"); |
} |