| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import 'dart:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 | 8 |
| 9 void testDefaultAddresses() { | 9 void testDefaultAddresses() { |
| 10 var loopback4 = InternetAddress.LOOPBACK_IP_V4; | 10 var loopback4 = InternetAddress.LOOPBACK_IP_V4; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 var any6 = InternetAddress.ANY_IP_V6; | 28 var any6 = InternetAddress.ANY_IP_V6; |
| 29 Expect.isNotNull(any6); | 29 Expect.isNotNull(any6); |
| 30 Expect.equals(InternetAddressType.IP_V6, any6.type); | 30 Expect.equals(InternetAddressType.IP_V6, any6.type); |
| 31 Expect.equals("::", any6.host); | 31 Expect.equals("::", any6.host); |
| 32 Expect.equals("::", any6.address); | 32 Expect.equals("::", any6.address); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void testReverseLookup() { | 35 void testReverseLookup() { |
| 36 InternetAddress.lookup('localhost').then((addrs) { | 36 InternetAddress.lookup('localhost').then((addrs) { |
| 37 addrs.first.reverse().then((addr) { | 37 addrs.first.reverse().then((addr) { |
| 38 Expect.equals('localhost', addr.host); | 38 Expect.isNotNull(addr.host); |
| 39 }); | 39 }); |
| 40 }); | 40 }); |
| 41 | 41 |
| 42 InternetAddress.lookup('127.0.0.1').then((addrs) { | 42 InternetAddress.lookup('127.0.0.1').then((addrs) { |
| 43 Expect.equals('127.0.0.1', addrs.first.host); |
| 43 addrs.first.reverse().then((addr) { | 44 addrs.first.reverse().then((addr) { |
| 44 Expect.equals('localhost', addr.host); | 45 Expect.isNotNull(addr.host); |
| 46 Expect.notEquals('127.0.0.1', addr.host); |
| 45 }); | 47 }); |
| 46 }); | 48 }); |
| 47 } | 49 } |
| 48 | 50 |
| 49 void main() { | 51 void main() { |
| 50 testDefaultAddresses(); | 52 testDefaultAddresses(); |
| 51 testReverseLookup(); | 53 testReverseLookup(); |
| 52 } | 54 } |
| OLD | NEW |