This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Bring cop label testing in line with intentions.
authorCraig A. Berry <craigberry@mac.com>
Sun, 17 Jul 2011 15:36:31 +0000 (10:36 -0500)
committerCraig A. Berry <craigberry@mac.com>
Sun, 17 Jul 2011 15:49:37 +0000 (10:49 -0500)
8375c93eec supplied tests for a newly exported API but the type
declarations for the arguments and return values didn't match the
types of the API being tested.

aebc0cbee0 renamed the functions without updating the calls to
those functions in the test.

Either of these could have been easily spotted by building with
g++ (or other readily available tools) before pushing.

This aside from the controversy over whether this particular API
is the one that should be publicly exported, so this all may be
reverted and replaced before 5.16.0, but hopefully it will unbreak
the build for now.

ext/XS-APItest/APItest.xs

index f1766c7..232a309 100644 (file)
@@ -2400,21 +2400,22 @@ void
 test_coplabel()
     PREINIT:
         COP *cop;
-        char *label;
-        int len, utf8;
+        const char *label;
+        STRLEN len;
+        U32 utf8;
     CODE:
         cop = &PL_compiling;
-        Perl_store_cop_label(aTHX_ cop, "foo", 3, 0);
-        label = Perl_fetch_cop_label(aTHX_ cop, &len, &utf8);
-        if (strcmp(label,"foo")) croak("fail # fetch_cop_label label");
-        if (len != 3) croak("fail # fetch_cop_label len");
-        if (utf8) croak("fail # fetch_cop_label utf8");
+        Perl_cop_store_label(aTHX_ cop, "foo", 3, 0);
+        label = Perl_cop_fetch_label(aTHX_ cop, &len, &utf8);
+        if (strcmp(label,"foo")) croak("fail # cop_fetch_label label");
+        if (len != 3) croak("fail # cop_fetch_label len");
+        if (utf8) croak("fail # cop_fetch_label utf8");
         /* SMALL GERMAN UMLAUT A */
-        Perl_store_cop_label(aTHX_ cop, "foä", 4, SVf_UTF8);
-        label = Perl_fetch_cop_label(aTHX_ cop, &len, &utf8);
-        if (strcmp(label,"foä")) croak("fail # fetch_cop_label label");
-        if (len != 3) croak("fail # fetch_cop_label len");
-        if (!utf8) croak("fail # fetch_cop_label utf8");
+        Perl_cop_store_label(aTHX_ cop, "foä", 4, SVf_UTF8);
+        label = Perl_cop_fetch_label(aTHX_ cop, &len, &utf8);
+        if (strcmp(label,"foä")) croak("fail # cop_fetch_label label");
+        if (len != 3) croak("fail # cop_fetch_label len");
+        if (!utf8) croak("fail # cop_fetch_label utf8");
 
 
 HV *