| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 validator_test; | 5 library validator_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'dart:json' as json; | 9 import 'dart:json' as json; |
| 10 import 'dart:math' as math; | 10 import 'dart:math' as math; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 expectValidationError(license); | 277 expectValidationError(license); |
| 278 }); | 278 }); |
| 279 | 279 |
| 280 integration('has an empty package name', () { | 280 integration('has an empty package name', () { |
| 281 dir(appPath, [libPubspec("", "1.0.0")]).scheduleCreate(); | 281 dir(appPath, [libPubspec("", "1.0.0")]).scheduleCreate(); |
| 282 expectValidationError(name); | 282 expectValidationError(name); |
| 283 }); | 283 }); |
| 284 | 284 |
| 285 integration('has a package name with an invalid character', () { | 285 integration('has a package name with an invalid character', () { |
| 286 dir(appPath, [libPubspec("test-pkg", "1.0.0")]).scheduleCreate(); | 286 dir(appPath, [libPubspec("test-pkg", "1.0.0")]).scheduleCreate(); |
| 287 expectValidationError(name); | 287 expectValidationWarning(name); |
| 288 }); | 288 }); |
| 289 | 289 |
| 290 integration('has a package name that begins with a number', () { | 290 integration('has a package name that begins with a number', () { |
| 291 dir(appPath, [libPubspec("8ball", "1.0.0")]).scheduleCreate(); | 291 dir(appPath, [libPubspec("8ball", "1.0.0")]).scheduleCreate(); |
| 292 expectValidationError(name); | 292 expectValidationWarning(name); |
| 293 }); | 293 }); |
| 294 | 294 |
| 295 integration('has a package name that contains upper-case letters', () { | 295 integration('has a package name that contains upper-case letters', () { |
| 296 dir(appPath, [libPubspec("TestPkg", "1.0.0")]).scheduleCreate(); | 296 dir(appPath, [libPubspec("TestPkg", "1.0.0")]).scheduleCreate(); |
| 297 expectValidationWarning(name); | 297 expectValidationWarning(name); |
| 298 }); | 298 }); |
| 299 | 299 |
| 300 integration('has a package name that is a Dart reserved word', () { | 300 integration('has a package name that is a Dart reserved word', () { |
| 301 dir(appPath, [libPubspec("final", "1.0.0")]).scheduleCreate(); | 301 dir(appPath, [libPubspec("final", "1.0.0")]).scheduleCreate(); |
| 302 expectValidationError(name); | 302 expectValidationError(name); |
| 303 }); | 303 }); |
| 304 | 304 |
| 305 integration('has a library name with an invalid character', () { | 305 integration('has a library name with an invalid character', () { |
| 306 dir(appPath, [ | 306 dir(appPath, [ |
| 307 libPubspec("test_pkg", "1.0.0"), | 307 libPubspec("test_pkg", "1.0.0"), |
| 308 dir("lib", [file("test-pkg.dart", "int i = 0;")]) | 308 dir("lib", [file("test-pkg.dart", "int i = 0;")]) |
| 309 ]).scheduleCreate(); | 309 ]).scheduleCreate(); |
| 310 expectValidationError(name); | 310 expectValidationWarning(name); |
| 311 }); | 311 }); |
| 312 | 312 |
| 313 integration('has a library name that begins with a number', () { | 313 integration('has a library name that begins with a number', () { |
| 314 dir(appPath, [ | 314 dir(appPath, [ |
| 315 libPubspec("test_pkg", "1.0.0"), | 315 libPubspec("test_pkg", "1.0.0"), |
| 316 dir("lib", [file("8ball.dart", "int i = 0;")]) | 316 dir("lib", [file("8ball.dart", "int i = 0;")]) |
| 317 ]).scheduleCreate(); | 317 ]).scheduleCreate(); |
| 318 expectValidationError(name); | 318 expectValidationWarning(name); |
| 319 }); | 319 }); |
| 320 | 320 |
| 321 integration('has a library name that contains upper-case letters', () { | 321 integration('has a library name that contains upper-case letters', () { |
| 322 dir(appPath, [ | 322 dir(appPath, [ |
| 323 libPubspec("test_pkg", "1.0.0"), | 323 libPubspec("test_pkg", "1.0.0"), |
| 324 dir("lib", [file("TestPkg.dart", "int i = 0;")]) | 324 dir("lib", [file("TestPkg.dart", "int i = 0;")]) |
| 325 ]).scheduleCreate(); | 325 ]).scheduleCreate(); |
| 326 expectValidationWarning(name); | 326 expectValidationWarning(name); |
| 327 }); | 327 }); |
| 328 | 328 |
| 329 integration('has a library name that is a Dart reserved word', () { | 329 integration('has a library name that is a Dart reserved word', () { |
| 330 dir(appPath, [ | 330 dir(appPath, [ |
| 331 libPubspec("test_pkg", "1.0.0"), | 331 libPubspec("test_pkg", "1.0.0"), |
| 332 dir("lib", [file("for.dart", "int i = 0;")]) | 332 dir("lib", [file("for.dart", "int i = 0;")]) |
| 333 ]).scheduleCreate(); | 333 ]).scheduleCreate(); |
| 334 expectValidationError(name); | 334 expectValidationWarning(name); |
| 335 }); | 335 }); |
| 336 | 336 |
| 337 integration('has a single library named differently than the package', () { | 337 integration('has a single library named differently than the package', () { |
| 338 file(path.join(appPath, "lib", "test_pkg.dart"), '').scheduleDelete(); | 338 file(path.join(appPath, "lib", "test_pkg.dart"), '').scheduleDelete(); |
| 339 dir(appPath, [ | 339 dir(appPath, [ |
| 340 dir("lib", [file("best_pkg.dart", "int i = 0;")]) | 340 dir("lib", [file("best_pkg.dart", "int i = 0;")]) |
| 341 ]).scheduleCreate(); | 341 ]).scheduleCreate(); |
| 342 expectValidationWarning(name); | 342 expectValidationWarning(name); |
| 343 }); | 343 }); |
| 344 | 344 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 }); | 576 }); |
| 577 | 577 |
| 578 test('has a README with invalid utf-8', () { | 578 test('has a README with invalid utf-8', () { |
| 579 dir(appPath, [ | 579 dir(appPath, [ |
| 580 binaryFile("README", [192]) | 580 binaryFile("README", [192]) |
| 581 ]).scheduleCreate(); | 581 ]).scheduleCreate(); |
| 582 expectValidationWarning(utf8Readme); | 582 expectValidationWarning(utf8Readme); |
| 583 }); | 583 }); |
| 584 }); | 584 }); |
| 585 } | 585 } |
| OLD | NEW |