MCPcopy Index your code
hub / github.com/HumbleUI/Skija / utfConversions

Method utfConversions

tests/java/ManagedStringTest.java:14–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12 }
13
14 public void utfConversions() throws Exception {
15 String[] valid = {
16 "abc",
17 "абв",
18 "\ud835\udc00", // valid surrogate pair (U+1D400)
19 };
20 for (String s : valid) {
21 try (var ms = new ManagedString(s)) {
22 assertEquals(s, ms.toString());
23 }
24 }
25
26 // Malformed UTF-16 must throw IllegalArgumentException.
27 String[] invalid = {
28 "\udc00", // lone low surrogate (first)
29 "A\udc00B", // lone low surrogate (middle)
30 "\ud835", // lone high surrogate (truncated)
31 "hello\ud83d", // lone high surrogate (at end)
32 "\ud835X\ud835", // high surrogate not followed by low
33 "\ud83d\ud83d", // high surrogate followed by high surrogate
34 "\ud835\u0041", // high surrogate followed by BMP char
35 };
36 for (String s : invalid) {
37 assertThrows(IllegalArgumentException.class, () -> {
38 new ManagedString(s).close();
39 });
40 }
41 }
42}

Callers

nothing calls this directly

Calls 4

assertEqualsMethod · 0.80
assertThrowsMethod · 0.80
toStringMethod · 0.65
closeMethod · 0.45

Tested by

no test coverage detected