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

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

Issue 14619008: Add static getters for common internet addresses (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 8 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 | « sdk/lib/io/socket.dart ('k') | tests/standalone/io/socket_ipv6_test.dart » ('j') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..67216d4b4555e0d028c7bcab18e07266555f8488
--- /dev/null
+++ b/tests/standalone/io/internet_address_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2013, 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.
+
+import 'dart:io';
+
+import "package:expect/expect.dart";
+
+void test() {
+ var loopback4 = InternetAddress.LOOPBACK_IP_V4;
+ Expect.isNotNull(loopback4);
+ Expect.equals(InternetAddressType.IP_V4, loopback4.type);
+ Expect.equals("localhost", loopback4.host);
+ Expect.equals("127.0.0.1", loopback4.address);
+
+ var loopback6 = InternetAddress.LOOPBACK_IP_V6;
+ Expect.isNotNull(loopback6);
+ Expect.equals(InternetAddressType.IP_V6, loopback6.type);
+ Expect.equals("ip6-localhost", loopback6.host);
+ Expect.equals("::1", loopback6.address);
+
+ var any4 = InternetAddress.ANY_IP_V4;
+ Expect.isNotNull(any4);
+ Expect.equals(InternetAddressType.IP_V4, any4.type);
+ Expect.equals("0.0.0.0", any4.host);
+ Expect.equals("0.0.0.0", any4.address);
+
+ var any6 = InternetAddress.ANY_IP_V6;
+ Expect.isNotNull(any6);
+ Expect.equals(InternetAddressType.IP_V6, any6.type);
+ Expect.equals("::", any6.host);
+ Expect.equals("::", any6.address);
+}
+
+void main() {
+ test();
+}
« no previous file with comments | « sdk/lib/io/socket.dart ('k') | tests/standalone/io/socket_ipv6_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698