blob: 964c12d2eb43f18585336e5ccc5d1b0617b49395 [file] [log] [blame]
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// @assertion Uri replace({
/// String scheme,
/// String userInfo,
/// String host,
/// int port,
/// String path,
/// Iterable<String> pathSegments,
/// String query,
/// Map<String, dynamic> queryParameters,
/// String fragment
/// })
/// Returns a new Uri based on this one, but with some parts replaced.
/// ...
/// At most one of path and pathSegments must be provided. Likewise, at most one
/// of query and queryParameters must be provided.
/// @description Check that exception is thrown if both path and pathSegments
/// specified
/// @author sgrekhov@unipro.ru
import "../../../Utils/expect.dart";
main() {
var url = Uri.parse("scheme://user:pass@host/path/?q#fr");
Expect.throws(() {
url.replace(path: "replaced1", pathSegments: ["replaced2"]);
});
Expect.throws(() {
url.replace(path: "replaced1", pathSegments: []);
});
Expect.throws(() {
url.replace(path: "", pathSegments: ["replaced2"]);
});
}