Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
Delete surrogate-related subtests to be compatible match breaking cha…
Browse files Browse the repository at this point in the history
…nge to UTF-8 encoding and decoding (#42)

* Delete surrogate-related subtests to be compatible with both behaviors
  • Loading branch information
askeksa committed May 4, 2020
1 parent f7925e6 commit 4cc1412
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions test/utf8_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,6 @@ main() {
expect(end, "😎👿💬");
});

test("toUtf8 unpaired surrogate", () {
final String start = String.fromCharCodes([0xD800, 0x1000]);
final Pointer<Utf8> converted = Utf8.toUtf8(start).cast();
final int length = Utf8.strlen(converted);
final Uint8List end = converted.cast<Uint8>().asTypedList(length + 1);
expect(end, equals([237, 160, 128, 225, 128, 128, 0]));
free(converted);
});

test("fromUtf8 unpaired surrogate", () {
final Pointer<Utf8> utf8 =
_bytesFromList([237, 160, 128, 225, 128, 128, 0]).cast();
final String end = Utf8.fromUtf8(utf8);
expect(end, equals(String.fromCharCodes([0xD800, 0x1000])));
});

test("fromUtf8 invalid", () {
final Pointer<Utf8> utf8 = _bytesFromList([0x80, 0x00]).cast();
expect(() => Utf8.fromUtf8(utf8), throwsA(isFormatException));
Expand Down

0 comments on commit 4cc1412

Please sign in to comment.