Skip to content

Commit

Permalink
Re #1758 unit tests verifies horace_install.m may account for spinW
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Oct 7, 2024
1 parent 754b8d7 commit c56d49d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
7 changes: 3 additions & 4 deletions _test/test_admin/test_horace_install.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ function test_files_in_folder_like_cloned_repo_with_spinW(obj)
assertFalse(use_old_init_folder);

assertEqual(new_install,install_folder);
%assertEqual(her_test_source,her_init_dir);
assertEqual(hor_test_source,hor_init_dir);

clear clob1;
clear clob2;
clear clOb;
assertTrue(contains(modified_hor_on_contents,spinw_foler));
end

%
function test_files_in_folder_like_Jenkins_repo_clean(obj)
% prepare fake Horace/Herbert code tree
Expand Down Expand Up @@ -218,7 +218,7 @@ function test_files_in_folder_like_installation_dir(obj)
assertEqual(fileparts(which('horace_on')),install_folder);
assertTrue(use_old_init_folder);

assertEqual(install_root,hor_admin);
assertEqual(install_root,hor_admin);
assertEqual(hor_test_source,hor_init_dir);

clear clob1;
Expand Down Expand Up @@ -280,7 +280,6 @@ function copy_install_files(~,source_files,target_folder)
copyfile(source,targ,'f');
end
end

end

end
24 changes: 14 additions & 10 deletions admin/horace_install.m
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,14 @@
);

% Install worker_v4 script (required by parallel routines) to user-path
install_file(worker_path, fullfile(init_folder, 'worker_v4.m'),opt.test_mode);
install_file(worker_path, fullfile(init_folder, 'worker_v4.m'),'','',opt.test_mode);

% Validate the installation
validate_function(@horace_on, @horace_off);

disp('Horace successfully installed.')
disp('Call ''horace_on'' to start using Horace.')
if ~opt.test_mode
% Validate the installation
validate_function(@horace_on, @horace_off);
disp('Horace successfully installed.')
disp('Call ''horace_on'' to start using Horace.')
end

end
% -----------------------------------------------------------------------------
Expand Down Expand Up @@ -258,7 +259,7 @@ function validate_path(x, arg_name)
% in placeholders with the string at the corresponding index in
% replace_strs.
%
if exist('placeholders', 'var')
if exist('placeholders', 'var') && ~isempty(placeholders)
file_contents = fileread(source);
for i = 1:numel(placeholders)
file_contents = replace(file_contents, placeholders{i}, replace_strs{i});
Expand All @@ -268,12 +269,15 @@ function validate_path(x, arg_name)
end
write_file(dest, file_contents);
else
if test_mode && nargout>0
file_contents = fileread(source);
if test_mode
if nargout>0
file_contents = fileread(source);
return;
end
else
copy_file(source, dest);
file_contents = [];
end
file_contents = [];
end
end

Expand Down

0 comments on commit c56d49d

Please sign in to comment.