Skip to content

Commit

Permalink
Add test class for internal functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ehennestad committed Oct 30, 2024
1 parent 60f98ab commit 53251c2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
22 changes: 1 addition & 21 deletions code/internal/+openminds/+internal/+utility/+dir/listFiles.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
keep = ~ strncmp({L.name}, '.', 1);
L = L(keep);

if ~strncmp(filetype, '.', 1)
if ~isempty(filetype) && ~strncmp(filetype, '.', 1)
filetype = strcat('.', filetype);
end

Expand All @@ -47,23 +47,3 @@
filename = {L.name};
end
end

% % function [folders, names, ext] = fileparts(varargin)
% %
% % [folders, names, ext] = deal(cell(1, numel(varargin)));
% %
% % for i = 1:numel(varargin)
% % [folders{i}, names{i}, ext{i}] = builtin('fileparts', varargin{i});
% % end
% %
% % if nargin == 1
% % folders = folders{1}; names = names{1}; ext = ext{1};
% % end
% %
% % if nargout == 1
% % clear names ext
% % elseif nargout == 2
% % clear ext
% % end
% %
% % end
20 changes: 20 additions & 0 deletions tools/tests/unitTests/InternalFunctionsTest.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
classdef InternalFunctionsTest < matlab.unittest.TestCase

methods(TestClassSetup)
% Shared setup for the entire test class
end

methods(TestMethodSetup)
% Setup for each test
end

methods(Test)

function testListFiles(testCase)
codeFolder = openminds.toolboxdir();
[filePath, filename] = openminds.internal.utility.dir.listFiles(codeFolder);
testCase.verifyClass(filePath, 'cell');
testCase.verifyClass(filename, 'cell');
end
end
end

0 comments on commit 53251c2

Please sign in to comment.