Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: tests/standalone/io/socket_invalid_arguments_test.dart

Issue 2361373003: Throw an ArgumentError if the port is out of range (Closed)
Patch Set: Address comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/socket_invalid_arguments_test.dart
diff --git a/tests/standalone/io/socket_invalid_arguments_test.dart b/tests/standalone/io/socket_invalid_arguments_test.dart
index 803e106714d09e12a4ac001508ae239d5752f7d0..4bc34b602208d4f828c66ace01d2d5ac7f0032d8 100644
--- a/tests/standalone/io/socket_invalid_arguments_test.dart
+++ b/tests/standalone/io/socket_invalid_arguments_test.dart
@@ -20,12 +20,17 @@ class NotAList {
testSocketCreation(host, port) {
asyncStart();
- Socket.connect(host, port)
- .then((socket) => Expect.fail("Shouldn't get connected"))
- .catchError((e) {
- Expect.isTrue(e is ArgumentError || e is SocketException);
- asyncEnd();
- });
+ try {
+ Socket.connect(host, port)
+ .then((socket) => Expect.fail("Shouldn't get connected"))
+ .catchError((e) {
+ Expect.isTrue(e is ArgumentError || e is SocketException);
+ asyncEnd();
+ });
+ } catch (e) {
+ Expect.isTrue(e is ArgumentError || e is SocketException);
+ asyncEnd();
+ }
}
testAdd(buffer) {
@@ -71,6 +76,8 @@ main() {
testSocketCreation(123, 123);
testSocketCreation("string", null);
testSocketCreation(null, null);
+ testSocketCreation("localhost", -1);
+ testSocketCreation("localhost", 65536);
testAdd(null);
testAdd(new NotAList());
testAdd(42);
@@ -82,4 +89,6 @@ main() {
testServerSocketCreation(123, 123, 123);
testServerSocketCreation("string", null, null);
testServerSocketCreation("string", 123, null);
+ testServerSocketCreation("localhost", -1, 123);
+ testServerSocketCreation("localhost", 65536, 123);
}
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698