| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 import 'package:pathos/path.dart' as path; | |
| 6 import 'package:scheduled_test/scheduled_test.dart'; | |
| 7 | |
| 8 import '../../../pub/entrypoint.dart'; | |
| 9 import '../../../pub/io.dart'; | |
| 10 import '../../../pub/validator.dart'; | |
| 11 import '../../../pub/validator/lib.dart'; | |
| 12 import '../descriptor.dart' as d; | |
| 13 import '../test_pub.dart'; | |
| 14 import 'utils.dart'; | |
| 15 | |
| 16 Validator lib(Entrypoint entrypoint) => new LibValidator(entrypoint); | |
| 17 | |
| 18 main() { | |
| 19 initConfig(); | |
| 20 | |
| 21 group('should consider a package valid if it', () { | |
| 22 setUp(d.validPackage.create); | |
| 23 | |
| 24 integration('looks normal', () => expectNoValidationError(lib)); | |
| 25 | |
| 26 integration('has a non-Dart file in lib', () { | |
| 27 d.dir(appPath, [ | |
| 28 d.libPubspec("test_pkg", "1.0.0"), | |
| 29 d.dir("lib", [ | |
| 30 d.file("thing.txt", "woo hoo") | |
| 31 ]) | |
| 32 ]).create(); | |
| 33 expectNoValidationError(lib); | |
| 34 }); | |
| 35 }); | |
| 36 | |
| 37 group('should consider a package invalid if it', () { | |
| 38 setUp(d.validPackage.create); | |
| 39 | |
| 40 integration('has no lib directory', () { | |
| 41 schedule(() => deleteEntry(path.join(sandboxDir, appPath, "lib"))); | |
| 42 expectValidationError(lib); | |
| 43 }); | |
| 44 | |
| 45 integration('has an empty lib directory', () { | |
| 46 schedule(() => | |
| 47 deleteEntry(path.join(sandboxDir, appPath, "lib", "test_pkg.dart"))); | |
| 48 expectValidationError(lib); | |
| 49 }); | |
| 50 | |
| 51 integration('has a lib directory containing only src', () { | |
| 52 schedule(() => | |
| 53 deleteEntry(path.join(sandboxDir, appPath, "lib", "test_pkg.dart"))); | |
| 54 d.dir(appPath, [ | |
| 55 d.dir("lib", [ | |
| 56 d.dir("src", [d.file("test_pkg.dart", "int i = 0;")]) | |
| 57 ]) | |
| 58 ]).create(); | |
| 59 expectValidationError(lib); | |
| 60 }); | |
| 61 }); | |
| 62 } | |
| OLD | NEW |