Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import "dart:async"; | 5 import "dart:async"; |
| 6 import "dart:convert"; | 6 import "dart:convert"; |
| 7 import "dart:io"; | 7 import "dart:io"; |
| 8 | 8 |
| 9 testAddressParse() async { | 9 testAddressParse() async { |
| 10 print(new InternetAddress("1.0.2.3").rawAddress); | 10 print(new InternetAddress("1.0.2.3").rawAddress); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 } | 396 } |
| 397 | 397 |
| 398 void testPlatformEnvironment() { | 398 void testPlatformEnvironment() { |
| 399 Map<String, String> env = Platform.environment; | 399 Map<String, String> env = Platform.environment; |
| 400 for (String k in env.keys) { | 400 for (String k in env.keys) { |
| 401 String v = env[k]; | 401 String v = env[k]; |
| 402 print("$k = '$v'"); | 402 print("$k = '$v'"); |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 | 405 |
| 406 Future testCopy() async { | |
| 407 final String sourceName = "foo"; | |
| 408 final String destName = "bar"; | |
| 409 Directory tmp = await Directory.systemTemp.createTemp("testCopy"); | |
| 410 File sourceFile = new File("${tmp.path}/$sourceName"); | |
| 411 File destFile = new File("${tmp.path}/$destName"); | |
| 412 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.
| |
| 413 await sourceFile.writeAsBytes(data); | |
| 414 await sourceFile.copy(destFile.path); | |
| 415 List<int> resultData = await destFile.readAsBytes(); | |
| 416 assert(data.length == resultData.length); | |
| 417 for (int i = 0; i < data.length; i++) { | |
| 418 assert(data[i] == resultData[i]); | |
| 419 } | |
| 420 await sourceFile.delete(); | |
| 421 await destFile.delete(); | |
| 422 await tmp.delete(); | |
| 423 } | |
| 424 | |
| 406 main() async { | 425 main() async { |
| 407 print("Hello, Fuchsia!"); | 426 print("Hello, Fuchsia!"); |
| 408 | 427 |
| 409 print("testAddressParse"); | 428 print("testAddressParse"); |
| 410 await testAddressParse(); | 429 await testAddressParse(); |
| 411 print("testAddressParse done"); | 430 print("testAddressParse done"); |
| 412 | 431 |
| 413 print("testSimpleBind"); | 432 print("testSimpleBind"); |
| 414 await testSimpleBind(); | 433 await testSimpleBind(); |
| 415 print("testSimpleBind done"); | 434 print("testSimpleBind done"); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 439 print("lsTest done"); | 458 print("lsTest done"); |
| 440 | 459 |
| 441 print("testPlatformEnvironment"); | 460 print("testPlatformEnvironment"); |
| 442 testPlatformEnvironment(); | 461 testPlatformEnvironment(); |
| 443 print("testPlatformEnvironment done"); | 462 print("testPlatformEnvironment done"); |
| 444 | 463 |
| 445 print("testProcess"); | 464 print("testProcess"); |
| 446 await testProcess(); | 465 await testProcess(); |
| 447 print("testProcess done"); | 466 print("testProcess done"); |
| 448 | 467 |
| 468 print("testCopy"); | |
| 469 await testCopy(); | |
| 470 print("testCopy done"); | |
| 471 | |
| 449 print("Goodbyte, Fuchsia!"); | 472 print("Goodbyte, Fuchsia!"); |
| 450 } | 473 } |
| OLD | NEW |