| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 library pub_tests; | |
| 6 | |
| 7 import 'package:path/path.dart' as p; | |
| 8 import 'package:scheduled_test/scheduled_test.dart'; | |
| 9 | |
| 10 import '../descriptor.dart' as d; | |
| 11 import '../test_pub.dart'; | |
| 12 | |
| 13 const BROKEN_TRANSFORMER = """ | |
| 14 import 'dart:async'; | |
| 15 | |
| 16 import 'package:barback/barback.dart'; | |
| 17 | |
| 18 class BrokenTransformer extends Transformer { | |
| 19 BrokenTransformer.asPlugin(); | |
| 20 | |
| 21 // This file intentionally has a syntax error so that any attempt to load it | |
| 22 // will crash. | |
| 23 """; | |
| 24 | |
| 25 main() { | |
| 26 initConfig(); | |
| 27 | |
| 28 // Regression test for issue 20917. | |
| 29 integration("snapshots the transformed version of an executable", () { | |
| 30 servePackages((builder) { | |
| 31 builder.serveRepoPackage('barback'); | |
| 32 | |
| 33 builder.serve( | |
| 34 "foo", | |
| 35 "1.2.3", | |
| 36 contents: [ | |
| 37 d.dir("bin", [d.file("hello.dart", "void main() => print('hello!')
;")])]); | |
| 38 }); | |
| 39 | |
| 40 d.dir(appPath, [d.pubspec({ | |
| 41 "name": "myapp", | |
| 42 "dependencies": { | |
| 43 "foo": "1.2.3", | |
| 44 "barback": "any" | |
| 45 }, | |
| 46 "transformers": ["myapp"] | |
| 47 }), | |
| 48 d.dir("lib", [d.file("transformer.dart", BROKEN_TRANSFORMER)])]).creat
e(); | |
| 49 | |
| 50 pubGet(output: contains("Precompiled foo:hello.")); | |
| 51 | |
| 52 d.dir( | |
| 53 p.join(appPath, '.pub', 'bin'), | |
| 54 [ | |
| 55 d.dir( | |
| 56 'foo', | |
| 57 [d.matcherFile('hello.dart.snapshot', contains('hello!'))])]).va
lidate(); | |
| 58 | |
| 59 var process = pubRun(args: ['foo:hello']); | |
| 60 process.stdout.expect("hello!"); | |
| 61 process.shouldExit(); | |
| 62 }); | |
| 63 } | |
| OLD | NEW |