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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 } | 373 } |
374 } catch (e) { | 374 } catch (e) { |
375 // Lookup failed or connection failed. Don't report a failure. | 375 // Lookup failed or connection failed. Don't report a failure. |
376 print("SocketException: $e"); | 376 print("SocketException: $e"); |
377 } finally { | 377 } finally { |
378 client.close(); | 378 client.close(); |
379 } | 379 } |
380 } | 380 } |
381 | 381 |
382 Future testProcess() async { | 382 Future testProcess() async { |
383 Process p = await Process.start(Platform.executable, ["--version"]); | 383 String exe = Platform.resolvedExecutable; |
| 384 print("Running $exe --version"); |
| 385 Process p = await Process.start(exe, ["--version"]); |
384 p.stderr.transform(UTF8.decoder).listen(print); | 386 p.stderr.transform(UTF8.decoder).listen(print); |
385 int code = await p.exitCode; | 387 int code = await p.exitCode; |
386 print("dart --version exited with code $code"); | 388 print("$exe --version exited with code $code"); |
387 } | 389 } |
388 | 390 |
389 Future testLs(String path) async { | 391 Future testLs(String path) async { |
390 Stream<FileSystemEntity> stream = (new Directory(path)).list(); | 392 Stream<FileSystemEntity> stream = (new Directory(path)).list(); |
391 await for (FileSystemEntity fse in stream) { | 393 await for (FileSystemEntity fse in stream) { |
392 print(fse.path); | 394 print(fse.path); |
393 } | 395 } |
394 } | 396 } |
395 | 397 |
| 398 void testPlatformEnvironment() { |
| 399 Map<String, String> env = Platform.environment; |
| 400 for (String k in env.keys) { |
| 401 String v = env[k]; |
| 402 print("$k = '$v'"); |
| 403 } |
| 404 } |
| 405 |
396 main() async { | 406 main() async { |
397 print("Hello, Fuchsia!"); | 407 print("Hello, Fuchsia!"); |
398 | 408 |
399 print("testAddressParse"); | 409 print("testAddressParse"); |
400 await testAddressParse(); | 410 await testAddressParse(); |
401 print("testAddressParse done"); | 411 print("testAddressParse done"); |
402 | 412 |
403 print("testSimpleBind"); | 413 print("testSimpleBind"); |
404 await testSimpleBind(); | 414 await testSimpleBind(); |
405 print("testSimpleBind done"); | 415 print("testSimpleBind done"); |
(...skipping 15 matching lines...) Expand all Loading... |
421 print("testGoogleHttp done"); | 431 print("testGoogleHttp done"); |
422 | 432 |
423 print("testGoogleHttps"); | 433 print("testGoogleHttps"); |
424 await testGoogleHttps(null, 'pass'); | 434 await testGoogleHttps(null, 'pass'); |
425 print("testGoogleHttps done"); | 435 print("testGoogleHttps done"); |
426 | 436 |
427 print("lsTest"); | 437 print("lsTest"); |
428 await testLs("/"); | 438 await testLs("/"); |
429 print("lsTest done"); | 439 print("lsTest done"); |
430 | 440 |
| 441 print("testPlatformEnvironment"); |
| 442 testPlatformEnvironment(); |
| 443 print("testPlatformEnvironment done"); |
| 444 |
431 print("testProcess"); | 445 print("testProcess"); |
432 await testProcess(); | 446 await testProcess(); |
433 print("testProcess done"); | 447 print("testProcess done"); |
434 | 448 |
435 print("Goodbyte, Fuchsia!"); | 449 print("Goodbyte, Fuchsia!"); |
436 } | 450 } |
OLD | NEW |