| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 bazel_test; | 5 library bazel_test; |
| 6 | 6 |
| 7 import 'package:protoc_plugin/bazel.dart'; | 7 import 'package:protoc_plugin/bazel.dart'; |
| 8 import 'package:test/test.dart'; | 8 import 'package:test/test.dart'; |
| 9 | 9 |
| 10 void main() { | 10 void main() { |
| 11 group('BazelOptionParser', () { | 11 group('BazelOptionParser', () { |
| 12 var optionParser; | 12 var optionParser; |
| 13 var packages; | 13 Map<String, BazelPackage> packages; |
| 14 var errors; | 14 var errors; |
| 15 | 15 |
| 16 setUp(() { | 16 setUp(() { |
| 17 packages = {}; | 17 packages = {}; |
| 18 optionParser = new BazelOptionParser(packages); | 18 optionParser = new BazelOptionParser(packages); |
| 19 errors = []; | 19 errors = []; |
| 20 }); | 20 }); |
| 21 | 21 |
| 22 _onError(String message) { | 22 _onError(String message) { |
| 23 errors.add(message); | 23 errors.add(message); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 expect(packages['b'].name, 'a'); | 104 expect(packages['b'].name, 'a'); |
| 105 expect(packages['b'].input_root, 'b'); | 105 expect(packages['b'].input_root, 'b'); |
| 106 expect(packages['b'].output_root, 'c'); | 106 expect(packages['b'].output_root, 'c'); |
| 107 expect(packages['d/e/f'].name, 'c'); | 107 expect(packages['d/e/f'].name, 'c'); |
| 108 expect(packages['d/e/f'].input_root, 'd/e/f'); | 108 expect(packages['d/e/f'].input_root, 'd/e/f'); |
| 109 expect(packages['d/e/f'].output_root, 'g/h'); | 109 expect(packages['d/e/f'].output_root, 'g/h'); |
| 110 }); | 110 }); |
| 111 }); | 111 }); |
| 112 | 112 |
| 113 group('BazelOutputConfiguration', () { | 113 group('BazelOutputConfiguration', () { |
| 114 var packages; | 114 Map<String, BazelPackage> packages; |
| 115 var config; | 115 var config; |
| 116 | 116 |
| 117 setUp(() { | 117 setUp(() { |
| 118 packages = { | 118 packages = { |
| 119 'foo/bar': new BazelPackage('a.b.c', 'foo/bar', 'baz/flob'), | 119 'foo/bar': new BazelPackage('a.b.c', 'foo/bar', 'baz/flob'), |
| 120 'foo/bar/baz': new BazelPackage('d.e.f', 'foo/bar/baz', 'baz/flob/foo'), | 120 'foo/bar/baz': new BazelPackage('d.e.f', 'foo/bar/baz', 'baz/flob/foo'), |
| 121 'wibble/wobble': | 121 'wibble/wobble': |
| 122 new BazelPackage('wibble.wobble', 'wibble/wobble', 'womble/wumble'), | 122 new BazelPackage('wibble.wobble', 'wibble/wobble', 'womble/wumble'), |
| 123 }; | 123 }; |
| 124 config = new BazelOutputConfiguration(packages); | 124 config = new BazelOutputConfiguration(packages); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 }); | 190 }); |
| 191 | 191 |
| 192 test('should throw if target is in unknown package', () { | 192 test('should throw if target is in unknown package', () { |
| 193 var target = Uri.parse('flob/flub/quux.proto'); | 193 var target = Uri.parse('flob/flub/quux.proto'); |
| 194 var source = Uri.parse('foo/bar/baz.proto'); | 194 var source = Uri.parse('foo/bar/baz.proto'); |
| 195 expect(() => config.resolveImport(target, source), throws); | 195 expect(() => config.resolveImport(target, source), throws); |
| 196 }); | 196 }); |
| 197 }); | 197 }); |
| 198 }); | 198 }); |
| 199 } | 199 } |
| OLD | NEW |