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

Fix utf8_test to match breaking change to UTF-8 encoding and decoding #42

Merged
merged 2 commits into from
May 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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