Skip to content

Commit

Permalink
Test Pointer return values in argless function
Browse files Browse the repository at this point in the history
  • Loading branch information
niner committed Sep 19, 2017
1 parent b6e6860 commit b7843ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions t/04-nativecall/01-argless.c
Expand Up @@ -27,6 +27,12 @@ DLLEXPORT long long ArglessLongLong()
return 2;
}

int my_int = 2;
DLLEXPORT int* ArglessPointer()
{
return &my_int;
}

DLLEXPORT int long_and_complicated_name()
{
return 3;
Expand Down
4 changes: 3 additions & 1 deletion t/04-nativecall/01-argless.t
Expand Up @@ -5,14 +5,15 @@ use CompileTestLib;
use NativeCall;
use Test;

plan 10;
plan 12;

compile_test_lib('01-argless');

sub Nothing() is native('./01-argless') { * }
sub Argless() is native('./01-argless') returns int32 { * }
sub ArglessChar() is native('./01-argless') returns int8 { * }
sub ArglessLongLong() is native('./01-argless') returns int64 { * }
sub ArglessPointer() is native('./01-argless') returns Pointer[int32] { * }
sub short() is native('./01-argless') returns int32 is symbol('long_and_complicated_name') { * }

Nothing() for ^2;
Expand All @@ -22,6 +23,7 @@ pass 'survived the call';
is Argless(), 2, 'called argless function' for ^2;
is ArglessChar(), 2, 'called argless function' for ^2;
is ArglessLongLong(), 2, 'called argless function' for ^2;
is ArglessPointer().deref, 2, 'called argless function' for ^2;

is short(), 3, 'called long_and_complicated_name';

Expand Down

0 comments on commit b7843ee

Please sign in to comment.