Implement Clownfish::Test::run_tests in Perl The XS implementation needed headers from the Clownfish parcel. If we decide to move the tests to a separate binary, this would require to move the implementation to a separate C file (or add a mechanism to include custom headers from the generated .xs file).
Implementing this function in Perl is solves this problem. Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/27dfd3a6 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/27dfd3a6 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/27dfd3a6 Branch: refs/heads/master Commit: 27dfd3a61868d6605ea6c50b24a65a4303ebcd03 Parents: 5195e08 Author: Nick Wellnhofer <[email protected]> Authored: Mon May 30 14:21:24 2016 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Mon May 30 15:13:26 2016 +0200 ---------------------------------------------------------------------- runtime/perl/buildlib/Clownfish/Build/Binding.pm | 11 +++-------- runtime/perl/lib/Clownfish/Test.pm | 11 +++++++++++ 2 files changed, 14 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/27dfd3a6/runtime/perl/buildlib/Clownfish/Build/Binding.pm ---------------------------------------------------------------------- diff --git a/runtime/perl/buildlib/Clownfish/Build/Binding.pm b/runtime/perl/buildlib/Clownfish/Build/Binding.pm index 618b43e..57d3a00 100644 --- a/runtime/perl/buildlib/Clownfish/Build/Binding.pm +++ b/runtime/perl/buildlib/Clownfish/Build/Binding.pm @@ -69,16 +69,11 @@ sub bind_test { my $xs_code = <<'END_XS_CODE'; MODULE = Clownfish PACKAGE = Clownfish::Test -bool -run_tests(class_name) - cfish_String *class_name; +SV* +create_test_suite() CODE: - cfish_TestFormatter *formatter - = (cfish_TestFormatter*)cfish_TestFormatterTAP_new(); cfish_TestSuite *suite = testcfish_Test_create_test_suite(); - RETVAL = CFISH_TestSuite_Run_Batch(suite, class_name, formatter); - CFISH_DECREF(formatter); - CFISH_DECREF(suite); + RETVAL = CFISH_OBJ_TO_SV_NOINC(suite); OUTPUT: RETVAL void http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/27dfd3a6/runtime/perl/lib/Clownfish/Test.pm ---------------------------------------------------------------------- diff --git a/runtime/perl/lib/Clownfish/Test.pm b/runtime/perl/lib/Clownfish/Test.pm index 185cefe..e637cd3 100644 --- a/runtime/perl/lib/Clownfish/Test.pm +++ b/runtime/perl/lib/Clownfish/Test.pm @@ -18,6 +18,17 @@ use Clownfish; our $VERSION = '0.005000'; $VERSION = eval $VERSION; +sub run_tests { + my $class_name = shift; + my $formatter = Clownfish::TestHarness::TestFormatterTAP->new(); + my $suite = Clownfish::Test::create_test_suite(); + + return $suite->run_batch( + class_name => "Clownfish::Test::TestClass", + formatter => $formatter, + ); +} + 1; __END__
