Understanding how testCase.addTeardown works with @path
이전 댓글 표시
classdef GoodFixturesTest < matlab.unittest.TestCase
methods(TestMethodSetup)
function addPath1(testCase)
p = addpath(fullfile(pwd, 'path1'));
testCase.addTeardown(@path, p);
end
function addPath2(testCase)
p = addpath(fullfile(pwd, 'path2'));
testCase.addTeardown(@path, p);
end
end
methods(Test)
function runTest(~)
end
end
end
So, I need to deeply understand how addTeardown works in this line
testCase.addTeardown(@path, p);
to remove the search paths of path1 and path2 and restore the original search paths in view of
testCase.addTeardown(tearDownFcn,arg1)
In other words, what is the meaning of passing all the search paths (including path1 and path2) stored in p to the function handle @path in order to restore the original search paths without the full paths of the newly added subfolders path1 and path2?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Write Unit Tests에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!