| 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 pubspec_test; | 5 library pubspec_test; |
| 6 | 6 |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
| 8 | 8 |
| 9 import '../lib/src/pubspec.dart'; | 9 import '../lib/src/pubspec.dart'; |
| 10 import '../lib/src/source.dart'; | 10 import '../lib/src/source.dart'; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 (pubspec) => pubspec.transformers); | 188 (pubspec) => pubspec.transformers); |
| 189 expectPubspecException('transformers: [12]', | 189 expectPubspecException('transformers: [12]', |
| 190 (pubspec) => pubspec.transformers); | 190 (pubspec) => pubspec.transformers); |
| 191 }); | 191 }); |
| 192 | 192 |
| 193 test("throws if a transformer's configuration isn't a map", () { | 193 test("throws if a transformer's configuration isn't a map", () { |
| 194 expectPubspecException('transformers: {pkg: 12}', | 194 expectPubspecException('transformers: {pkg: 12}', |
| 195 (pubspec) => pubspec.transformers); | 195 (pubspec) => pubspec.transformers); |
| 196 }); | 196 }); |
| 197 | 197 |
| 198 test("throws if a transformer's configuration contains a top-level key " |
| 199 "beginning with a dollar sign", () { |
| 200 expectPubspecException('transformers: {pkg: {\$key: value}}', |
| 201 (pubspec) => pubspec.transformers); |
| 202 }); |
| 203 |
| 204 test("doesn't throw if a transformer's configuration contains a " |
| 205 "non-top-level key beginning with a dollar sign", () { |
| 206 expectPubspecException('transformers: {pkg: {\$key: value}}', |
| 207 (pubspec) => pubspec.transformers); |
| 208 }); |
| 209 |
| 198 test("allows comment-only files", () { | 210 test("allows comment-only files", () { |
| 199 var pubspec = new Pubspec.parse(''' | 211 var pubspec = new Pubspec.parse(''' |
| 200 # No external dependencies yet | 212 # No external dependencies yet |
| 201 # Including for completeness | 213 # Including for completeness |
| 202 # ...and hoping the spec expands to include details about author, version, etc | 214 # ...and hoping the spec expands to include details about author, version, etc |
| 203 # See http://www.dartlang.org/docs/pub-package-manager/ for details | 215 # See http://www.dartlang.org/docs/pub-package-manager/ for details |
| 204 ''', sources); | 216 ''', sources); |
| 205 expect(pubspec.version, equals(Version.none)); | 217 expect(pubspec.version, equals(Version.none)); |
| 206 expect(pubspec.dependencies, isEmpty); | 218 expect(pubspec.dependencies, isEmpty); |
| 207 }); | 219 }); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 (pubspec) => pubspec.environment); | 252 (pubspec) => pubspec.environment); |
| 241 }); | 253 }); |
| 242 | 254 |
| 243 test("throws if the sdk isn't a valid version constraint", () { | 255 test("throws if the sdk isn't a valid version constraint", () { |
| 244 expectPubspecException('environment: {sdk: "oopies"}', | 256 expectPubspecException('environment: {sdk: "oopies"}', |
| 245 (pubspec) => pubspec.environment); | 257 (pubspec) => pubspec.environment); |
| 246 }); | 258 }); |
| 247 }); | 259 }); |
| 248 }); | 260 }); |
| 249 } | 261 } |
| OLD | NEW |