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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/preprocess_test.dart

Issue 887223007: Revert "Use native async/await support in pub." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library pub.test.preprocess_test; 5 library pub.test.preprocess_test;
6 6
7 import 'package:pub_semver/pub_semver.dart'; 7 import 'package:pub_semver/pub_semver.dart';
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 9
10 import '../lib/src/preprocess.dart'; 10 import '../lib/src/preprocess.dart';
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 test("disallows insert directive without space", () { 241 test("disallows insert directive without space", () {
242 expect(() => _preprocess('//>foo'), throwsFormatException); 242 expect(() => _preprocess('//>foo'), throwsFormatException);
243 }); 243 });
244 244
245 group("if", () { 245 group("if", () {
246 test("disallows if with no arguments", () { 246 test("disallows if with no arguments", () {
247 expect(() => _preprocess('//# if\n//# end'), throwsFormatException); 247 expect(() => _preprocess('//# if\n//# end'), throwsFormatException);
248 }); 248 });
249 249
250 test("disallows if with no package", () { 250 test("disallows if with no package", () {
251 expect(() => _preprocess('//# if <=1.0.0\n//# end'), 251 expect(
252 () => _preprocess('//# if <=1.0.0\n//# end'),
252 throwsFormatException); 253 throwsFormatException);
253 }); 254 });
254 255
255 test("disallows invalid version constraint", () { 256 test("disallows invalid version constraint", () {
256 expect(() => _preprocess('//# if barback >=1.0\n//# end'), 257 expect(
258 () => _preprocess('//# if barback >=1.0\n//# end'),
257 throwsFormatException); 259 throwsFormatException);
258 }); 260 });
259 261
260 test("disallows dangling end", () { 262 test("disallows dangling end", () {
261 expect(() => _preprocess('//# end'), 263 expect(() => _preprocess('//# end'), throwsFormatException);
264 });
265
266 test("disallows if without end", () {
267 expect(
268 () => _preprocess('//# if barback >=1.0.0'),
262 throwsFormatException); 269 throwsFormatException);
263 }); 270 });
264 271
265 test("disallows if without end", () {
266 expect(() => _preprocess('//# if barback >=1.0.0'),
267 throwsFormatException);
268 });
269
270 test("disallows nested if", () { 272 test("disallows nested if", () {
271 expect(() => _preprocess(''' 273 expect(() => _preprocess('''
272 //# if barback >=1.0.0 274 //# if barback >=1.0.0
273 //# if barback >= 1.5.0 275 //# if barback >= 1.5.0
274 //# end 276 //# end
275 //# end 277 //# end
276 '''), 278 '''), throwsFormatException);
277 throwsFormatException);
278 }); 279 });
279 }); 280 });
280 281
281 group("else", () { 282 group("else", () {
282 test("disallows else without if", () { 283 test("disallows else without if", () {
283 expect(() => _preprocess('//# else\n//# end'), throwsFormatException); 284 expect(() => _preprocess('//# else\n//# end'), throwsFormatException);
284 }); 285 });
285 286
286 test("disallows else without end", () { 287 test("disallows else without end", () {
287 expect(() => _preprocess('//# if barback >=1.0.0\n//# else'), 288 expect(
289 () => _preprocess('//# if barback >=1.0.0\n//# else'),
288 throwsFormatException); 290 throwsFormatException);
289 }); 291 });
290 292
291 test("disallows else with an argument", () { 293 test("disallows else with an argument", () {
292 expect(() => _preprocess(''' 294 expect(() => _preprocess('''
293 //# if barback >=1.0.0 295 //# if barback >=1.0.0
294 //# else barback <0.5.0 296 //# else barback <0.5.0
295 //# end 297 //# end
296 '''), throwsFormatException); 298 '''), throwsFormatException);
297 }); 299 });
298 }); 300 });
299 }); 301 });
300 } 302 }
301 303
302 String _preprocess(String input) => 304 String _preprocess(String input) => preprocess(input, {
303 preprocess(input, {'barback': new Version.parse("1.2.3")}, 'source/url'); 305 'barback': new Version.parse("1.2.3")
306 }, 'source/url');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698