OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 import 'dart:io'; |
| 6 |
| 7 import 'package:analyzer_cli/src/driver.dart'; |
| 8 import 'package:analyzer_cli/src/options.dart'; |
| 9 import 'package:path/path.dart' as path; |
| 10 import 'package:test/test.dart'; |
| 11 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 12 |
| 13 import 'utils.dart'; |
| 14 |
| 15 main() { |
| 16 defineReflectiveTests(ErrorUpgradeFailsCli); |
| 17 } |
| 18 |
| 19 @reflectiveTest |
| 20 class ErrorUpgradeFailsCli { |
| 21 StringSink savedOutSink, savedErrorSink; |
| 22 int savedExitCode; |
| 23 ExitHandler savedExitHandler; |
| 24 |
| 25 void setUp() { |
| 26 savedOutSink = outSink; |
| 27 savedErrorSink = errorSink; |
| 28 savedExitHandler = exitHandler; |
| 29 savedExitCode = exitCode; |
| 30 exitHandler = (code) => exitCode = code; |
| 31 outSink = new StringBuffer(); |
| 32 errorSink = new StringBuffer(); |
| 33 } |
| 34 |
| 35 void tearDown() { |
| 36 outSink = savedOutSink; |
| 37 errorSink = savedErrorSink; |
| 38 exitCode = savedExitCode; |
| 39 exitHandler = savedExitHandler; |
| 40 } |
| 41 |
| 42 test_once() async { |
| 43 String testDir = |
| 44 path.join(testDirectory, 'data', 'error_upgrade_fails_cli'); |
| 45 Driver driver = new Driver(); |
| 46 await driver.start([path.join(testDir, 'foo.dart')]); |
| 47 |
| 48 expect(exitCode, 3); |
| 49 } |
| 50 } |
OLD | NEW |