diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-11-02 13:37:24 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-02 13:37:24 -0500 |
| commit | 061ff11b2b8aca33fec0d5d381855d5bd3aa6ff9 (patch) | |
| tree | 43488e010c69f136e7d7a91535ad477ecafcc6fb /lib/std/unicode.zig | |
| parent | ecdd6366052ec815466db0c64b2a5abe59267393 (diff) | |
| parent | dc872a221d8301cfac4b9ead09196c5b18cf63b2 (diff) | |
| download | zig-061ff11b2b8aca33fec0d5d381855d5bd3aa6ff9.tar.gz zig-061ff11b2b8aca33fec0d5d381855d5bd3aa6ff9.zip | |
Merge pull request #6927 from LemonBoy/mipsbe-std
Fixes for stdlib for mips BE targets
Diffstat (limited to 'lib/std/unicode.zig')
| -rw-r--r-- | lib/std/unicode.zig | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/std/unicode.zig b/lib/std/unicode.zig index 86b805b892..18bd5ab0e2 100644 --- a/lib/std/unicode.zig +++ b/lib/std/unicode.zig @@ -706,41 +706,52 @@ fn calcUtf16LeLen(utf8: []const u8) usize { } test "utf8ToUtf16LeStringLiteral" { - // https://github.com/ziglang/zig/issues/5127 - if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; - { - const bytes = [_:0]u16{0x41}; + const bytes = [_:0]u16{ + mem.nativeToLittle(u16, 0x41), + }; const utf16 = utf8ToUtf16LeStringLiteral("A"); testing.expectEqualSlices(u16, &bytes, utf16); testing.expect(utf16[1] == 0); } { - const bytes = [_:0]u16{ 0xD801, 0xDC37 }; + const bytes = [_:0]u16{ + mem.nativeToLittle(u16, 0xD801), + mem.nativeToLittle(u16, 0xDC37), + }; const utf16 = utf8ToUtf16LeStringLiteral("𐐷"); testing.expectEqualSlices(u16, &bytes, utf16); testing.expect(utf16[2] == 0); } { - const bytes = [_:0]u16{0x02FF}; + const bytes = [_:0]u16{ + mem.nativeToLittle(u16, 0x02FF), + }; const utf16 = utf8ToUtf16LeStringLiteral("\u{02FF}"); testing.expectEqualSlices(u16, &bytes, utf16); testing.expect(utf16[1] == 0); } { - const bytes = [_:0]u16{0x7FF}; + const bytes = [_:0]u16{ + mem.nativeToLittle(u16, 0x7FF), + }; const utf16 = utf8ToUtf16LeStringLiteral("\u{7FF}"); testing.expectEqualSlices(u16, &bytes, utf16); testing.expect(utf16[1] == 0); } { - const bytes = [_:0]u16{0x801}; + const bytes = [_:0]u16{ + mem.nativeToLittle(u16, 0x801), + }; const utf16 = utf8ToUtf16LeStringLiteral("\u{801}"); testing.expectEqualSlices(u16, &bytes, utf16); testing.expect(utf16[1] == 0); } { - const bytes = [_:0]u16{ 0xDBFF, 0xDFFF }; + const bytes = [_:0]u16{ + mem.nativeToLittle(u16, 0xDBFF), + mem.nativeToLittle(u16, 0xDFFF), + }; const utf16 = utf8ToUtf16LeStringLiteral("\u{10FFFF}"); testing.expectEqualSlices(u16, &bytes, utf16); testing.expect(utf16[2] == 0); |
