Skip to content

Commit

Permalink
Pass Uint8List to Datagram (#382)
Browse files Browse the repository at this point in the history
This is in preparation for Datagram requiring a
Uint8List passed to its constructor. This is a
forward-compatible change.

dart-lang/sdk#36900
#381
  • Loading branch information
tvolkert authored and athomas committed Jun 11, 2019
1 parent dc528a3 commit 6ccebbf
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion LibTest/io/Datagram/Datagram_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
* @author sgrekhov@unipro.ru
*/
import "dart:io";
import "dart:typed_data";
import "../../../Utils/expect.dart";

main() {
InternetAddress address = new InternetAddress("127.0.0.1");
Datagram datagram = new Datagram([1, 2, 3], address, 80);
Datagram datagram = new Datagram(Uint8List.fromList([1, 2, 3]), address, 80);
Expect.listEquals([1, 2, 3], datagram.data);
Expect.equals(address, datagram.address);
Expect.equals(80, datagram.port);
Expand Down
3 changes: 2 additions & 1 deletion LibTest/io/Datagram/Datagram_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
* @author sgrekhov@unipro.ru
*/
import "dart:io";
import "dart:typed_data";
import "../../../Utils/expect.dart";

main() {
InternetAddress address = new InternetAddress("::1");
Datagram datagram = new Datagram([1, 2, 3], address, 43);
Datagram datagram = new Datagram(Uint8List.fromList([1, 2, 3]), address, 43);
Expect.listEquals([1, 2, 3], datagram.data);
Expect.equals(address, datagram.address);
Expect.equals(43, datagram.port);
Expand Down
3 changes: 2 additions & 1 deletion LibTest/io/Datagram/address_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
* @author sgrekhov@unipro.ru
*/
import "dart:io";
import "dart:typed_data";
import "../../../Utils/expect.dart";

main() {
InternetAddress address = new InternetAddress("127.0.0.1");
Datagram datagram = new Datagram([], address, 80);
Datagram datagram = new Datagram(new Uint8List(0), address, 80);
Expect.equals(address, datagram.address);

address = new InternetAddress("::127");
Expand Down
3 changes: 2 additions & 1 deletion LibTest/io/Datagram/data_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
* @author sgrekhov@unipro.ru
*/
import "dart:io";
import "dart:typed_data";
import "../../../Utils/expect.dart";

main() {
InternetAddress address = new InternetAddress("127.0.0.1");
Datagram datagram = new Datagram([], address, 80);
Datagram datagram = new Datagram(new Uint8List(0), address, 80);
Expect.listEquals([], datagram.data);

datagram.data = [1, 2, 3];
Expand Down
3 changes: 2 additions & 1 deletion LibTest/io/Datagram/port_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
* @author sgrekhov@unipro.ru
*/
import "dart:io";
import "dart:typed_data";
import "../../../Utils/expect.dart";

main() {
InternetAddress address = new InternetAddress("127.0.0.1");
Datagram datagram = new Datagram([], address, 80);
Datagram datagram = new Datagram(new Uint8List(0), address, 80);
Expect.equals(80, datagram.port);

datagram.port = 43;
Expand Down

0 comments on commit 6ccebbf

Please sign in to comment.