apjanke / octave-testify

New BIST (Built-In Self Test) functions for GNU Octave
GNU General Public License v3.0
4 stars 2 forks source link

feature request: test could consume the struct array returned by dir() #30

Closed mtmiller closed 5 years ago

mtmiller commented 5 years ago

The dir function in Octave and Matlab returns a struct array describing the files matched by the pattern. Would be a nice enhancement if test could directly consume that struct array.

test (dir ('cheb*.m'))

Would be shorthand equivalent to

d_arrray = dir ('cheb*.m');
n_array = {d_array.name};
test (n_array)

assuming that #29 is done.

apjanke commented 5 years ago

This one I'd rather not do. The alternative representations of files as strings or "dir structs" seems orthogonal to what the test functions support, and I'd rather see this supported by external functions to transform between them, that could be used in conjunction with any function that takes lists of files.

E.g. you could define a dir_structs_to_paths() function and then do something like runtests (dir_structs_to_paths (dir ('cheb*.m'))).

I see an issue, though: test and runtests are command-style functions that take lists of string args, so you can't directly pass a list of filenames to one of their function parameters. I'll fix that.

apjanke commented 5 years ago

Added support for cellstr arguments to runtests2_refactor in https://github.com/apjanke/octave-testify/commit/d4738695473f130544e02867369a82a42a105ac4. Now runtests2_refactor (dir_structs_to_paths (dir ('cheb*.m'))) would work.

Going to call this fixed. Please re-open if you really really want support for this.

mtmiller commented 5 years ago

LGTM