Index: sdk/lib/_internal/pub_generated/test/preprocess_test.dart |
diff --git a/sdk/lib/_internal/pub/test/preprocess_test.dart b/sdk/lib/_internal/pub_generated/test/preprocess_test.dart |
similarity index 86% |
copy from sdk/lib/_internal/pub/test/preprocess_test.dart |
copy to sdk/lib/_internal/pub_generated/test/preprocess_test.dart |
index 98aef17ba5ec4becfb075a5f2f2212de391aff6c..37686fab01b195b9434ee2262f6e034690c6664e 100644 |
--- a/sdk/lib/_internal/pub/test/preprocess_test.dart |
+++ b/sdk/lib/_internal/pub_generated/test/preprocess_test.dart |
@@ -1,18 +1,10 @@ |
-// 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.test.preprocess_test; |
- |
import 'package:unittest/unittest.dart'; |
- |
import '../lib/src/preprocess.dart'; |
import '../lib/src/version.dart'; |
import 'test_pub.dart'; |
- |
main() { |
initConfig(); |
- |
test("does nothing on a file without preprocessor directives", () { |
var text = ''' |
some text |
@@ -20,14 +12,11 @@ some text |
// # |
//# not beginning of line |
'''; |
- |
expect(_preprocess(text), equals(text)); |
}); |
- |
test("allows bare insert directive", () { |
expect(_preprocess('//> foo'), equals('foo')); |
}); |
- |
test("allows empty insert directive", () { |
expect(_preprocess(''' |
//> foo |
@@ -35,7 +24,6 @@ some text |
//> bar |
'''), equals('foo\n\nbar\n')); |
}); |
- |
group("if", () { |
group("with a version range", () { |
test("removes sections with non-matching versions", () { |
@@ -50,7 +38,6 @@ before |
after |
''')); |
}); |
- |
test("doesn't insert section with non-matching versions", () { |
expect(_preprocess(''' |
before |
@@ -63,7 +50,6 @@ before |
after |
''')); |
}); |
- |
test("doesn't remove sections with matching versions", () { |
expect(_preprocess(''' |
before |
@@ -77,7 +63,6 @@ inside |
after |
''')); |
}); |
- |
test("inserts sections with matching versions", () { |
expect(_preprocess(''' |
before |
@@ -91,7 +76,6 @@ inside |
after |
''')); |
}); |
- |
test("allows multi-element version ranges", () { |
expect(_preprocess(''' |
before |
@@ -109,7 +93,6 @@ after |
''')); |
}); |
}); |
- |
group("with a package name", () { |
test("removes sections for a nonexistent package", () { |
expect(_preprocess(''' |
@@ -123,7 +106,6 @@ before |
after |
''')); |
}); |
- |
test("doesn't insert sections for a nonexistent package", () { |
expect(_preprocess(''' |
before |
@@ -136,7 +118,6 @@ before |
after |
''')); |
}); |
- |
test("doesn't remove sections with an existent package", () { |
expect(_preprocess(''' |
before |
@@ -150,7 +131,6 @@ inside |
after |
''')); |
}); |
- |
test("inserts sections with an existent package", () { |
expect(_preprocess(''' |
before |
@@ -166,7 +146,6 @@ after |
}); |
}); |
}); |
- |
group("else", () { |
test("removes non-matching sections", () { |
expect(_preprocess(''' |
@@ -183,7 +162,6 @@ inside 1 |
after |
''')); |
}); |
- |
test("doesn't insert non-matching sections", () { |
expect(_preprocess(''' |
before |
@@ -199,7 +177,6 @@ inside 1 |
after |
''')); |
}); |
- |
test("doesn't remove matching sections", () { |
expect(_preprocess(''' |
before |
@@ -215,7 +192,6 @@ inside 2 |
after |
''')); |
}); |
- |
test("inserts matching sections", () { |
expect(_preprocess(''' |
before |
@@ -232,62 +208,53 @@ after |
''')); |
}); |
}); |
- |
group("errors", () { |
test("disallows unknown statements", () { |
expect(() => _preprocess('//# foo bar\n//# end'), throwsFormatException); |
}); |
- |
test("disallows insert directive without space", () { |
expect(() => _preprocess('//>foo'), throwsFormatException); |
}); |
- |
group("if", () { |
test("disallows if with no arguments", () { |
expect(() => _preprocess('//# if\n//# end'), throwsFormatException); |
}); |
- |
test("disallows if with no package", () { |
- expect(() => _preprocess('//# if <=1.0.0\n//# end'), |
+ expect( |
+ () => _preprocess('//# if <=1.0.0\n//# end'), |
throwsFormatException); |
}); |
- |
test("disallows invalid version constraint", () { |
- expect(() => _preprocess('//# if barback >=1.0\n//# end'), |
+ expect( |
+ () => _preprocess('//# if barback >=1.0\n//# end'), |
throwsFormatException); |
}); |
- |
test("disallows dangling end", () { |
- expect(() => _preprocess('//# end'), |
- throwsFormatException); |
+ expect(() => _preprocess('//# end'), throwsFormatException); |
}); |
- |
test("disallows if without end", () { |
- expect(() => _preprocess('//# if barback >=1.0.0'), |
+ expect( |
+ () => _preprocess('//# if barback >=1.0.0'), |
throwsFormatException); |
}); |
- |
test("disallows nested if", () { |
expect(() => _preprocess(''' |
//# if barback >=1.0.0 |
//# if barback >= 1.5.0 |
//# end |
//# end |
-'''), |
- throwsFormatException); |
+'''), throwsFormatException); |
}); |
}); |
- |
group("else", () { |
test("disallows else without if", () { |
expect(() => _preprocess('//# else\n//# end'), throwsFormatException); |
}); |
- |
test("disallows else without end", () { |
- expect(() => _preprocess('//# if barback >=1.0.0\n//# else'), |
+ expect( |
+ () => _preprocess('//# if barback >=1.0.0\n//# else'), |
throwsFormatException); |
}); |
- |
test("disallows else with an argument", () { |
expect(() => _preprocess(''' |
//# if barback >=1.0.0 |
@@ -298,6 +265,6 @@ after |
}); |
}); |
} |
- |
-String _preprocess(String input) => |
- preprocess(input, {'barback': new Version.parse("1.2.3")}, 'source/url'); |
+String _preprocess(String input) => preprocess(input, { |
+ 'barback': new Version.parse("1.2.3") |
+}, 'source/url'); |