Skip to content

Commit 53a54ff

Browse files
committed
check the void context fix for sv_numeq too
1 parent 4cfda98 commit 53a54ff

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

ext/XS-APItest/APItest.xs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5055,6 +5055,14 @@ sv_numeq_flags(nullable_SV sv1, nullable_SV sv2, U32 flags)
50555055
OUTPUT:
50565056
RETVAL
50575057

5058+
# deliberately void context
5059+
void
5060+
void_sv_numeq(nullable_SV sv1, nullable_SV sv2, SV *out)
5061+
CODE:
5062+
sv_setbool(out, sv_numeq(sv1, sv2));
5063+
OUTPUT:
5064+
out
5065+
50585066
bool
50595067
sv_numne(nullable_SV sv1, nullable_SV sv2)
50605068

ext/XS-APItest/t/sv_numeq.t

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!perl
22

3-
use Test::More tests => 23;
3+
use Test::More tests => 25;
44
use XS::APItest;
55
use Config;
66

@@ -46,6 +46,12 @@ ok sv_numeq_flags($1, 10, SV_GMAGIC), 'sv_numeq_flags with SV_GMAGIC does';
4646

4747
ok !sv_numeq_flags($obj, 10, SV_SKIP_OVERLOAD), 'AlwaysTen is not 10 with SV_SKIP_OVERLOAD';
4848
ok !sv_numeq_flags($obj, 123456, SV_SKIP_OVERLOAD), 'AlwaysTen is not its overloaded numeric value with SV_SKIP_OVERLOAD';
49+
50+
my $result;
51+
void_sv_numeq($obj, 10, $result);
52+
ok($result, "overloaded sv_numeq() (eq) in void context");
53+
void_sv_numeq($obj, 12, $result);
54+
ok(!$result, "overloaded sv_numeq() (ne) in void context");
4955
}
5056

5157
# +0 overloading with large numbers and using fallback

0 commit comments

Comments
 (0)