This repository has been archived by the owner on Apr 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from dart-lang/sdk_ext_fixes_tests
Add some tests for sdk extensions and ".packages" support.
- Loading branch information
Showing
12 changed files
with
162 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
.buildlog | ||
.DS_Store | ||
.idea | ||
.packages | ||
/.packages | ||
.project | ||
.pub/ | ||
.settings/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:foo'; | ||
|
||
main() { | ||
// import of 'dart:foo' should resolve to a file which defines bar(). | ||
bar(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"dart:foo": "foo.dart" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
void bar() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package_with_sdk_extension:../package_with_sdk_extension/lib/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:foo'; | ||
|
||
main() { | ||
// import of 'dart:foo' should resolve to a file which defines bar(). | ||
bar(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/// Test that sdk extensions are properly detected in various scenarios. | ||
library analyzer_cli.test.sdk_ext; | ||
|
||
import 'dart:io'; | ||
|
||
import 'package:analyzer_cli/src/driver.dart' show Driver, errorSink, outSink; | ||
import 'package:path/path.dart' as path; | ||
import 'package:test/test.dart'; | ||
|
||
import 'utils.dart'; | ||
|
||
main() { | ||
group('Sdk extensions', () { | ||
StringSink savedOutSink, savedErrorSink; | ||
int savedExitCode; | ||
Directory savedCurrentDirectory; | ||
setUp(() { | ||
savedOutSink = outSink; | ||
savedErrorSink = errorSink; | ||
savedExitCode = exitCode; | ||
outSink = new StringBuffer(); | ||
errorSink = new StringBuffer(); | ||
savedCurrentDirectory = Directory.current; | ||
}); | ||
tearDown(() { | ||
outSink = savedOutSink; | ||
errorSink = savedErrorSink; | ||
exitCode = savedExitCode; | ||
Directory.current = savedCurrentDirectory; | ||
}); | ||
|
||
test('--packages option supplied', () async { | ||
var testDir = path.join(testDirectory, 'data', 'no_packages_file'); | ||
Directory.current = new Directory(testDir); | ||
var packagesPath = path.join('..', 'packages_file', '.packages'); | ||
new Driver().start(['--packages', packagesPath, 'sdk_ext_user.dart']); | ||
|
||
expect(exitCode, 0); | ||
}); | ||
|
||
test('.packages file present', () async { | ||
var testDir = path.join(testDirectory, 'data', 'packages_file'); | ||
Directory.current = new Directory(testDir); | ||
new Driver().start(['sdk_ext_user.dart']); | ||
|
||
expect(exitCode, 0); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters