| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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 json_rpc_2.test.server.parameters_test; | 5 library json_rpc_2.test.server.parameters_test; |
| 6 | 6 |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
| 8 import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc; | 8 import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc; |
| 9 | 9 |
| 10 import 'utils.dart'; | 10 import 'utils.dart'; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 test("[].asUri fails for non-URI parameters", () { | 255 test("[].asUri fails for non-URI parameters", () { |
| 256 expect(() => parameters['int'].asUri, | 256 expect(() => parameters['int'].asUri, |
| 257 throwsInvalidParams('Parameter "int" for method "foo" must be a ' | 257 throwsInvalidParams('Parameter "int" for method "foo" must be a ' |
| 258 'string, but was 1.')); | 258 'string, but was 1.')); |
| 259 }); | 259 }); |
| 260 | 260 |
| 261 test("[].asUri fails for invalid URIs", () { | 261 test("[].asUri fails for invalid URIs", () { |
| 262 expect(() => parameters['invalid-uri'].asUri, | 262 expect(() => parameters['invalid-uri'].asUri, |
| 263 throwsInvalidParams('Parameter "invalid-uri" for method "foo" must ' | 263 throwsInvalidParams('Parameter "invalid-uri" for method "foo" must ' |
| 264 'be a valid URI, but was "http://[::1".\n' | 264 'be a valid URI, but was "http://[::1".\n' |
| 265 'Unmatched [ in host name at position 7.\n' | 265 'Bad end of IPv6 host')); |
| 266 'http://[::1\n' | |
| 267 ' ^')); | |
| 268 }); | 266 }); |
| 269 | 267 |
| 270 group("with a nested parameter map", () { | 268 group("with a nested parameter map", () { |
| 271 var nested; | 269 var nested; |
| 272 setUp(() => nested = parameters['map']); | 270 setUp(() => nested = parameters['map']); |
| 273 | 271 |
| 274 test("[int] fails with a type error", () { | 272 test("[int] fails with a type error", () { |
| 275 expect(() => nested[0], | 273 expect(() => nested[0], |
| 276 throwsInvalidParams('Parameter "map" for method "foo" must be an ' | 274 throwsInvalidParams('Parameter "map" for method "foo" must be an ' |
| 277 'Array, but was {"num":4.2,"bool":false}.')); | 275 'Array, but was {"num":4.2,"bool":false}.')); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 test("with a complex parameter path", () { | 366 test("with a complex parameter path", () { |
| 369 var parameters = new json_rpc.Parameters("foo", { | 367 var parameters = new json_rpc.Parameters("foo", { |
| 370 'bar baz': [0, 1, 2, {'bang.zap': {'\n': 'qux'}}] | 368 'bar baz': [0, 1, 2, {'bang.zap': {'\n': 'qux'}}] |
| 371 }); | 369 }); |
| 372 | 370 |
| 373 expect(() => parameters['bar baz'][3]['bang.zap']['\n']['bip'], | 371 expect(() => parameters['bar baz'][3]['bang.zap']['\n']['bip'], |
| 374 throwsInvalidParams('Parameter "bar baz"[3]."bang.zap"."\\n" for ' | 372 throwsInvalidParams('Parameter "bar baz"[3]."bang.zap"."\\n" for ' |
| 375 'method "foo" must be an Object, but was "qux".')); | 373 'method "foo" must be an Object, but was "qux".')); |
| 376 }); | 374 }); |
| 377 } | 375 } |
| OLD | NEW |