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

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

Issue 101913008: Add argument checking to InternetAddress constructor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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/internet_address_test.dart
diff --git a/tests/standalone/io/internet_address_test.dart b/tests/standalone/io/internet_address_test.dart
index d8a997f897067aa0bbe55d3385e292ecf4691ea3..5e7eeee974edd982708fb7036fad1780a8e731d9 100644
--- a/tests/standalone/io/internet_address_test.dart
+++ b/tests/standalone/io/internet_address_test.dart
@@ -6,6 +6,16 @@ import 'dart:io';
import "package:expect/expect.dart";
+void testIllegalArguments() {
+ var args = [
+ null, 1, 1.1, new Object(), [], {'a' : '127.0.0.1'},
+ "", "." , ":", ":::"];
+ args.forEach((arg) {
+ Expect.throws(() => new InternetAddress(arg),
+ (e) => e is ArgumentError);
+ });
+}
+
void testDefaultAddresses() {
var loopback4 = InternetAddress.LOOPBACK_IP_V4;
Expect.isNotNull(loopback4);
@@ -131,6 +141,7 @@ void testReverseLookup() {
}
void main() {
+ testIllegalArguments();
testDefaultAddresses();
testConstructor();
testEquality();
« 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