Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Unified Diff: sdk/lib/_internal/pub_generated/test/dependency_computer/cycle_test.dart

Issue 657673002: Regenerate pub sources. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub_generated/test/dependency_computer/cycle_test.dart
diff --git a/sdk/lib/_internal/pub_generated/test/dependency_computer/cycle_test.dart b/sdk/lib/_internal/pub_generated/test/dependency_computer/cycle_test.dart
index fefc3cf0072167c67864126cc1db0f9d042999e2..bfe4cb2402eaae919ef579ad8a7d2dccfeabfde9 100644
--- a/sdk/lib/_internal/pub_generated/test/dependency_computer/cycle_test.dart
+++ b/sdk/lib/_internal/pub_generated/test/dependency_computer/cycle_test.dart
@@ -1,9 +1,16 @@
+// Copyright (c) 2014, 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.
+
library pub_tests;
+
import '../descriptor.dart' as d;
import '../test_pub.dart';
import 'utils.dart';
+
void main() {
initConfig();
+
integration(
"allows a package dependency cycle that's unrelated to " "transformers",
() {
@@ -21,29 +28,37 @@ void main() {
[
d.file("first.dart", transformer()),
d.file("second.dart", transformer())])]).create();
+
d.dir("foo", [d.libPubspec("foo", "1.0.0", deps: {
"bar": {
"path": "../bar"
}
})]).create();
+
d.dir("bar", [d.libPubspec("bar", "1.0.0", deps: {
"baz": {
"path": "../baz"
}
})]).create();
+
d.dir("baz", [d.libPubspec("baz", "1.0.0", deps: {
"foo": {
"path": "../foo"
}
})]).create();
+
expectDependencies({
'myapp/first': [],
'myapp/second': ['myapp/first']
});
});
+
integration(
"disallows a package dependency cycle that may be related to " "transformers",
() {
+ // Two layers of myapp transformers are necessary here because otherwise pub
+ // will figure out that the transformer doesn't import "foo" and thus
+ // doesn't transitively import itself. Import loops are tested below.
d.dir(appPath, [d.pubspec({
"name": "myapp",
"dependencies": {
@@ -58,16 +73,19 @@ void main() {
[
d.file("first.dart", transformer()),
d.file("second.dart", transformer())])]).create();
+
d.dir("foo", [d.libPubspec("foo", "1.0.0", deps: {
"bar": {
"path": "../bar"
}
})]).create();
+
d.dir("bar", [d.libPubspec("bar", "1.0.0", deps: {
"myapp": {
"path": "../myapp"
}
})]).create();
+
expectCycleException(
[
"myapp is transformed by myapp/second",
@@ -76,6 +94,7 @@ void main() {
"bar depends on myapp",
"myapp is transformed by myapp/first"]);
});
+
integration("disallows a transformation dependency cycle", () {
d.dir(appPath, [d.pubspec({
"name": "myapp",
@@ -86,6 +105,7 @@ void main() {
},
"transformers": ["foo"]
}), d.dir('lib', [d.file("myapp.dart", transformer())])]).create();
+
d.dir("foo", [d.pubspec({
"name": "foo",
"dependencies": {
@@ -95,6 +115,7 @@ void main() {
},
"transformers": ["bar"]
}), d.dir('lib', [d.file("foo.dart", transformer())])]).create();
+
d.dir("bar", [d.pubspec({
"name": "bar",
"dependencies": {
@@ -104,12 +125,14 @@ void main() {
},
"transformers": ["myapp"]
}), d.dir('lib', [d.file("bar.dart", transformer())])]).create();
+
expectCycleException(
[
"bar is transformed by myapp",
"myapp is transformed by foo",
"foo is transformed by bar"]);
});
+
integration(
"allows a cross-package import cycle that's unrelated to " "transformers",
() {
@@ -125,28 +148,33 @@ void main() {
d.dir(
'lib',
[d.file("myapp.dart", transformer(['package:foo/foo.dart']))])]).create();
+
d.dir("foo", [d.libPubspec("foo", "1.0.0", deps: {
"bar": {
"path": "../bar"
}
}),
d.dir('lib', [d.file("foo.dart", "import 'package:bar/bar.dart';")])]).create();
+
d.dir("bar", [d.libPubspec("bar", "1.0.0", deps: {
"baz": {
"path": "../baz"
}
}),
d.dir('lib', [d.file("bar.dart", "import 'package:baz/baz.dart';")])]).create();
+
d.dir("baz", [d.libPubspec("baz", "1.0.0", deps: {
"foo": {
"path": "../foo"
}
}),
d.dir('lib', [d.file("baz.dart", "import 'package:foo/foo.dart';")])]).create();
+
expectDependencies({
'myapp': []
});
});
+
integration(
"disallows a cross-package import cycle that's related to " "transformers",
() {
@@ -162,12 +190,14 @@ void main() {
d.dir(
'lib',
[d.file("myapp.dart", transformer(['package:foo/foo.dart']))])]).create();
+
d.dir("foo", [d.libPubspec("foo", "1.0.0", deps: {
"bar": {
"path": "../bar"
}
}),
d.dir('lib', [d.file("foo.dart", "import 'package:bar/bar.dart';")])]).create();
+
d.dir("bar", [d.libPubspec("bar", "1.0.0", deps: {
"myapp": {
"path": "../myapp"
@@ -176,6 +206,7 @@ void main() {
d.dir(
'lib',
[d.file("bar.dart", "import 'package:myapp/myapp.dart';")])]).create();
+
expectCycleException(
[
"myapp is transformed by myapp",
@@ -183,6 +214,7 @@ void main() {
"foo depends on bar",
"bar depends on myapp"]);
});
+
integration(
"allows a single-package import cycle that's unrelated to " "transformers",
() {
@@ -202,10 +234,12 @@ void main() {
d.file("foo.dart", "import 'bar.dart';"),
d.file("bar.dart", "import 'baz.dart';"),
d.file("baz.dart", "import 'foo.dart';")])]).create();
+
expectDependencies({
'myapp': []
});
});
+
integration(
"allows a single-package import cycle that's related to " "transformers",
() {
@@ -223,7 +257,8 @@ void main() {
[
d.file("myapp.dart", transformer(['foo.dart'])),
d.file("foo.dart", "import 'bar.dart';"),
- d.file("bar.dart", "import 'myapp.dart';")])]).create();
+ d.file("bar.dart", "import 'myapp.dart';"),])]).create();
+
expectDependencies({
'myapp': []
});

Powered by Google App Engine
This is Rietveld 408576698