|
4 | 4 |
|
5 | 5 | import 'dart:convert';
|
6 | 6 |
|
| 7 | +import 'package:path/path.dart' as p; |
7 | 8 | import 'package:shelf/shelf.dart' as shelf;
|
8 | 9 | import 'package:shelf_test_handler/shelf_test_handler.dart';
|
9 | 10 | import 'package:test/test.dart';
|
10 | 11 |
|
11 | 12 | import 'package:pub/src/exit_codes.dart' as exit_codes;
|
| 13 | +import 'package:pub/src/io.dart'; |
12 | 14 |
|
13 | 15 | import '../descriptor.dart' as d;
|
14 | 16 | import '../test_pub.dart';
|
@@ -37,6 +39,40 @@ main() {
|
37 | 39 | await pub.shouldExit(exit_codes.SUCCESS);
|
38 | 40 | });
|
39 | 41 |
|
| 42 | + // This is a regression test for #1679. We create a submodule that's not |
| 43 | + // checked out to ensure that file listing doesn't choke on the empty |
| 44 | + // directory. |
| 45 | + test('with an empty Git submodule', () async { |
| 46 | + await d.git('empty').create(); |
| 47 | + |
| 48 | + var repo = d.git(appPath); |
| 49 | + await repo.create(); |
| 50 | + |
| 51 | + await repo.runGit(['submodule', 'add', '../empty', 'empty']); |
| 52 | + await repo.commit(); |
| 53 | + |
| 54 | + deleteEntry(p.join(d.sandbox, appPath, 'empty')); |
| 55 | + await d.dir(p.join(appPath, 'empty')).create(); |
| 56 | + |
| 57 | + var server = await ShelfTestServer.create(); |
| 58 | + await d.credentialsFile(server, 'access token').create(); |
| 59 | + var pub = await startPublish(server); |
| 60 | + |
| 61 | + await confirmPublish(pub); |
| 62 | + handleUploadForm(server); |
| 63 | + handleUpload(server); |
| 64 | + |
| 65 | + server.handler.expect('GET', '/create', (request) { |
| 66 | + return new shelf.Response.ok(JSON.encode({ |
| 67 | + 'success': {'message': 'Package test_pkg 1.0.0 uploaded!'} |
| 68 | + })); |
| 69 | + }); |
| 70 | + |
| 71 | + expect(pub.stdout, emits(startsWith('Uploading...'))); |
| 72 | + expect(pub.stdout, emits('Package test_pkg 1.0.0 uploaded!')); |
| 73 | + await pub.shouldExit(exit_codes.SUCCESS); |
| 74 | + }); |
| 75 | + |
40 | 76 | // TODO(nweiz): Once a multipart/form-data parser in Dart exists, we should
|
41 | 77 | // test that "pub lish" chooses the correct files to publish.
|
42 | 78 | }
|
0 commit comments