| 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:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/sdk_io.dart'; |
| 7 import 'package:analyzer_cli/src/driver.dart' show Driver, errorSink, outSink; | 8 import 'package:analyzer_cli/src/driver.dart' show Driver, errorSink, outSink; |
| 8 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
| 9 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| 10 | 11 |
| 11 import 'utils.dart'; | 12 import 'utils.dart'; |
| 12 | 13 |
| 13 main() { | 14 main() { |
| 14 initializeTestEnvironment(); | 15 initializeTestEnvironment(); |
| 15 | 16 |
| 16 group('_embedder.yaml', () { | 17 group('_embedder.yaml', () { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 34 var testDir = path.join(testDirectory, 'data', 'embedder_client'); | 35 var testDir = path.join(testDirectory, 'data', 'embedder_client'); |
| 35 new Driver().start([ | 36 new Driver().start([ |
| 36 '--packages', | 37 '--packages', |
| 37 path.join(testDir, '_packages'), | 38 path.join(testDir, '_packages'), |
| 38 path.join(testDir, 'embedder_yaml_user.dart') | 39 path.join(testDir, 'embedder_yaml_user.dart') |
| 39 ]); | 40 ]); |
| 40 | 41 |
| 41 expect(exitCode, 0); | 42 expect(exitCode, 0); |
| 42 expect(outSink.toString(), contains('No issues found')); | 43 expect(outSink.toString(), contains('No issues found')); |
| 43 })); | 44 })); |
| 45 |
| 46 test('sdk setup', wrap(() { |
| 47 var testDir = path.join(testDirectory, 'data', 'embedder_client'); |
| 48 Driver driver = new Driver(); |
| 49 driver.start([ |
| 50 '--packages', |
| 51 path.join(testDir, '_packages'), |
| 52 path.join(testDir, 'embedder_yaml_user.dart') |
| 53 ]); |
| 54 |
| 55 DirectoryBasedDartSdk sdk = driver.sdk; |
| 56 expect(sdk.useSummary, false); |
| 57 })); |
| 44 }); | 58 }); |
| 45 } | 59 } |
| 46 | 60 |
| 47 /// Wrap a function call to dump stdout and stderr in case of an exception. | 61 /// Wrap a function call to dump stdout and stderr in case of an exception. |
| 48 Function wrap(Function f) { | 62 Function wrap(Function f) { |
| 49 return () { | 63 return () { |
| 50 try { | 64 try { |
| 51 f(); | 65 f(); |
| 52 } catch (e) { | 66 } catch (e) { |
| 53 if (outSink.toString().isNotEmpty) { | 67 if (outSink.toString().isNotEmpty) { |
| 54 print('stdout:'); | 68 print('stdout:'); |
| 55 print(outSink); | 69 print(outSink); |
| 56 } | 70 } |
| 57 if (errorSink.toString().isNotEmpty) { | 71 if (errorSink.toString().isNotEmpty) { |
| 58 print('stderr:'); | 72 print('stderr:'); |
| 59 print(errorSink); | 73 print(errorSink); |
| 60 } | 74 } |
| 61 throw e; | 75 throw e; |
| 62 } | 76 } |
| 63 }; | 77 }; |
| 64 } | 78 } |
| OLD | NEW |