Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MATLAB R2016b compatibility #20

Merged
merged 4 commits into from
Dec 21, 2016

Conversation

bauglir
Copy link
Contributor

@bauglir bauglir commented Dec 16, 2016

This PR contains compatibility fixes for MATLAB R2016b. The most important one of which is a fix for initTestSuite, which no longer works in versions post-R2016b. As was also reported by @amroamroamro in #19. Our solutions are mostly similar.

This fix proposes an alternative buildFunctionHandleTestSuite function for these versions, and implements an alternative initTestSuite script employing this new function.

I'm aware of one issue with using buildFunctionHandleTestSuite on older versions of MATLAB (prior to R2014b), which is related to getting a cell array of handles to local functions. In versions prior to R2013b the localfunctions command does not even exist, and between R2013b and R2014b it doesn't properly detect local functions for packaged functions. I have tried to abstract these different approaches into a single function call, but haven't been able to get that to work. This function would look similar to code currently in initTestSuite, but as soon as the code getting the list of function handles gets pushed into a function, obtaining correctly functioning function handles, no longer works. The alternate approach to calling buildFunctionHandleTestSuite when localfunctions is not available is outlined in the documentation for buildFunctionHandleTestSuite.

bauglir and others added 4 commits December 16, 2016 17:38
…s on R2016b and later

The `initTestSuite` can no longer be used in R2016b and later, due to
the way scripts are scoped in those versions. Instead the
`buildFunctionHandleTestSuite` function should be used.

In fact, this is the preferred way for generating these types of test
suites across all MATLAB versions that support them. `initTestSuite` has
been updated to generate warnings about the changed behavior in R2016b
and errors out with a descriptive error on affected versions. And
documentation is available in `buildFunctionHandleTestSuite` describing
how to support older MATLAB versions.

Fixes psexton#19.
@psexton
Copy link
Owner

psexton commented Dec 21, 2016

All tests pass in {13b, 14a, 14b, 15a, 15b, 16a, 16b} * {Win7 64-bit, Linux 64-bit}.

@psexton psexton merged commit f7cbdef into psexton:master Dec 21, 2016
@bauglir bauglir deleted the matlab-r2016b-compatibility branch December 22, 2016 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants