[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Pkg-octave-devel] Bug#672756: Bug#672756: Bug#672756: octave-pkg-dev: testsuite does not handle files under inst/private



* Sébastien Villemot <sebastien.villemot@ens.fr> [2012-05-30 11:38]:

> Rafael Laboissiere <rafael@laboissiere.net> writes:
> 
> I had not realized that it was indeed a design mistake. Given that, it
> probably makes sense to choose your option (2) below:
> 
> > (2) We inform the upstream author about the design mistake.  In the case
> > of tbl_delim.m in octave-statistics, in particular, the tests were kept
> > when the file moved from inst/__tbl_delim__.m into
> > inst/private/tbl_delim.m [*].  A rational thing to do would be to move
> > the tests from tbl_delim.m into tblwrite.m, the only place where
> > tbl_delim() is invoked.
> 
> I know that other packages besides statistics are affected. We need to
> identify them and report the issues upstream.

Attached below is a patch that might fix the problem in
octave-statistics.

Rafael

Description: Expose the tests of the private function tbl_delim
Author: Rafael Laboissière <rafael@laboissiere.net>
Last-Update: 2012-05-30

--- octave-statistics-1.1.3.orig/inst/tblwrite.m
+++ octave-statistics-1.1.3/inst/tblwrite.m
@@ -84,6 +84,87 @@ function x = __makecell__ (x, name)
 endfunction
 
 ## Tests
+%!shared privpath
+%! privpath = [fileparts(which('tblwrite')) filesep() 'private'];
+## Tests for tbl_delim (private function)
+%!test
+%! addpath (privpath,'-end')
+%! [d err] = tbl_delim (" ");
+%! assert (d, " ");
+%! assert (err, "");
+%! rmpath (privpath);
+## Named delimiters
+%!test
+%! addpath (privpath,'-end')
+%! [d err] = tbl_delim ("space");
+%! assert (d, " ");
+%! assert (err, "");
+%! rmpath (privpath);
+%!test
+%! addpath (privpath,'-end')
+%! [d err] = tbl_delim ("tab");
+%! assert (d, sprintf ("\t"));
+%! assert (err, "");
+%! rmpath (privpath);
+%!test
+%! addpath (privpath,'-end')
+%! [d err] = tbl_delim ("comma");
+%! assert (d, ",");
+%! assert (err, "");
+%! rmpath (privpath);
+%!test
+%! addpath (privpath,'-end')
+%! [d err] = tbl_delim ("semi");
+%! assert (d, ";");
+%! assert (err, "");
+%! rmpath (privpath);
+%!test
+%! addpath (privpath,'-end')
+%! [d err] = tbl_delim ("bar");
+%! assert (d, "|");
+%! assert (err, "");
+%! rmpath (privpath);
+## An arbitrary character
+%!test
+%! addpath (privpath,'-end')
+%! [d err] = tbl_delim ("x");
+%! assert (d, "x");
+%! assert (err, "");
+%! rmpath (privpath);
+## An arbitrary escape string
+%!test
+%! addpath (privpath,'-end')
+%! [d err] = tbl_delim ('\r');
+%! assert (d, sprintf ('\r'))
+%! assert (err, "");
+%! rmpath (privpath);
+## Errors
+%!test
+%! addpath (privpath,'-end')
+%! [d err] = tbl_delim ("bars");
+%! assert (isnan (d));
+%! assert (! isempty (err));
+%! rmpath (privpath);
+%!test
+%! addpath (privpath,'-end')
+%! [d err] = tbl_delim ("");
+%! assert (isnan (d));
+%! assert (! isempty (err));
+%! rmpath (privpath);
+%!test
+%! addpath (privpath,'-end')
+%! [d err] = tbl_delim (5);
+%! assert (isnan (d));
+%! assert (! isempty (err));
+%! rmpath (privpath);
+%!test
+%! addpath (privpath,'-end')
+%! [d err] = tbl_delim ({"."});
+%! assert (isnan (d));
+%! assert (! isempty (err));
+%! rmpath (privpath);
+##
+## Tests for tblwrite
 %!shared d, v, c
 %! d = [1 2;3 4];
 %! v = ["a ";"bc"];
--- octave-statistics-1.1.3.orig/inst/private/tbl_delim.m
+++ octave-statistics-1.1.3/inst/private/tbl_delim.m
@@ -69,58 +69,3 @@ function [d, err] = tbl_delim (d)
   endif
 
 endfunction
-
-## Tests
-## The defaults
-%!test
-%! [d err] = tbl_delim (" ");
-%! assert (d, " ");
-%! assert (err, "");
-## Named delimiters
-%!test
-%! [d err] = tbl_delim ("space");
-%! assert (d, " ");
-%! assert (err, "");
-%!test
-%! [d err] = tbl_delim ("tab");
-%! assert (d, sprintf ("\t"));
-%! assert (err, "");
-%!test
-%! [d err] = tbl_delim ("comma");
-%! assert (d, ",");
-%! assert (err, "");
-%!test
-%! [d err] = tbl_delim ("semi");
-%! assert (d, ";");
-%! assert (err, "");
-%!test
-%! [d err] = tbl_delim ("bar");
-%! assert (d, "|");
-%! assert (err, "");
-## An arbitrary character
-%!test
-%! [d err] = tbl_delim ("x");
-%! assert (d, "x");
-%! assert (err, "");
-## An arbitrary escape string
-%!test
-%! [d err] = tbl_delim ('\r');
-%! assert (d, sprintf ('\r'))
-%! assert (err, "");
-## Errors
-%!test
-%! [d err] = tbl_delim ("bars");
-%! assert (isnan (d));
-%! assert (! isempty (err));
-%!test
-%! [d err] = tbl_delim ("");
-%! assert (isnan (d));
-%! assert (! isempty (err));
-%!test
-%! [d err] = tbl_delim (5);
-%! assert (isnan (d));
-%! assert (! isempty (err));
-%!test
-%! [d err] = tbl_delim ({"."});
-%! assert (isnan (d));
-%! assert (! isempty (err));

Reply to: