This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
*ctl: test that we throw on a code point above 0xff
authorTony Cook <tony@develop-help.com>
Tue, 17 Nov 2020 03:25:36 +0000 (14:25 +1100)
committerTony Cook <tony@develop-help.com>
Tue, 24 Nov 2020 02:35:21 +0000 (13:35 +1100)
These functions expect a packed structure of some point
representing bytes from the structure in memory.

t/io/sem.t

index ff3df5f..07e3fab 100644 (file)
@@ -87,5 +87,11 @@ else {
        "set all semaphores from an upgraded string");
     is(semctl($id, $sem2set, GETVAL, $ignored), $semval+1,
        "test value set from UTF-8");
+
+    # third, that we throw on a code point above 0xFF
+    substr($semvals, 0, 1) = chr(0x101);
+    ok(!eval { semctl($id, "ignored", SETALL, $semvals); 1 },
+       "throws on code points above 0xff");
+    like($@, qr/Wide character/, "with the expected error");
 }