add expand_macro

CVS patchset: 6668
CVS date: 2003/03/09 17:53:35
This commit is contained in:
cturner 2003-03-09 17:53:35 +00:00
parent 6da035db56
commit 477a3e0e3c
2 changed files with 17 additions and 1 deletions

View File

@ -49,6 +49,17 @@ delete_macro(pkg, name)
CODE:
delMacro(NULL, name);
void
expand_macro(pkg, str)
char * pkg
char * str
PREINIT:
char *ret;
PPCODE:
ret = rpmExpand(str, NULL);
PUSHs(sv_2mortal(newSVpv(ret, 0)));
free(ret);
int
rpmvercmp(one, two)
char* one

View File

@ -11,7 +11,7 @@ use strict;
use Test;
use strict;
BEGIN { plan tests => 30 };
BEGIN { plan tests => 33 };
use RPM2;
ok(1); # If we made it this far, we're ok.
@ -111,3 +111,8 @@ else {
ok(1);
}
ok(RPM2->expand_macro("%%foo") eq "%foo");
RPM2->add_macro("rpm2_test_macro", "testval $$");
ok(RPM2->expand_macro("%rpm2_test_macro") eq "testval $$");
RPM2->delete_macro("rpm2_test_macro");
ok(RPM2->expand_macro("%rpm2_test_macro") eq "%rpm2_test_macro");