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 takes a cell array of files or function names #29

Closed mtmiller closed 5 years ago

mtmiller commented 5 years ago

We have test to test a single file, and runtests to test a directory. It would be ideal if one or both of these functions took a cell array of names to iterate over.

Some examples that seem like they should just work

test (glob ('cheb*.m'))
test ({'func1', 'func2'})

By extension, a slightly more wacky idea would be to always run glob on the argument, or maybe only if it looks like a pattern?

test ('*foo*.m')
apjanke commented 5 years ago

I have modified runtests2_refactor to take multiple arguments. You can pass in multiple files and/or directories and it will test all of them in turn.

I also added support for file globs.

Your examples won't work as is, but close analogs that do work now are:

runtests2_refactor cheb*.m
runtests2_refactor -glob cheb*.m
runtests2_refactor func1 func2
funcs = {'func1' 'func2'};
runtests2_refactor (funcs{:})
runtests2_refactor *foo*.m

Is that close enough?

mtmiller commented 5 years ago

Ok, that works for me.

And the one-liner also works

runtests2_refactor (glob ('*foo*.m'){:})