Skip to content
Snippets Groups Projects
Commit bd0939a3 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

STY: Style fixes.

parent 5730d7e5
No related branches found
No related tags found
1 merge request!2Enhanced functionality testing
Pipeline #11832 failed
......@@ -26,6 +26,18 @@ help:
@echo "Targets:"
@echo " test - run the test."
###############################################################################
# Style and linting #
###############################################################################
style:
mh_style --octave test || ( echo 'You may want to run `make style_fix`.'; exit 1 )
.PHONY: style
style_fix:
mh_style --fix --octave test
.PHONY: style_fix
###############################################################################
# Tests #
###############################################################################
......@@ -33,3 +45,4 @@ help:
test:
cd test && octave Run_Test.m
.PHONY: test
......@@ -19,5 +19,5 @@
pkg load caosdb;
test_result = moxunit_runtests("-verbose", "test_caosdb.m");
if not(test_result)
exit(1)
exit(1);
end
function test_suite=test_caosdb()
% This file is a part of the CaosDB Project.
%
% Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
% Copyright (C) 2021 Daniel Hornung <d.hornung@indiscale.com>
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU Affero General Public License as
% published by the Free Software Foundation, either version 3 of the
% License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU Affero General Public License for more details.
%
% You should have received a copy of the GNU Affero General Public License
% along with this program. If not, see <https://www.gnu.org/licenses/>.
%% The main function which intitializes the tests.
function test_suite = test_caosdb()
try % assignment of 'localfunctions' is necessary in Matlab >= 2016
test_functions=localfunctions();
test_functions = localfunctions();
catch % no problem; early Matlab versions can use initTestSuite fine
end
initTestSuite;
......@@ -14,7 +33,7 @@ function test_connection()
info = c1.info();
% another working connection
c2 = Caosdb(connection = "local-caosdb-admin");
c2 = Caosdb("local-caosdb-admin");
c2.info();
% This connection should fail
......@@ -25,17 +44,16 @@ function test_connection()
if moxunit_util_platform_is_octave()
assertExceptionThrown(@non_existing_connection);
else
assertExceptionThrown(@non_existing_connection,"16");
assertExceptionThrown(@non_existing_connection, "16");
end
expected_msg = ...
strjoin(
{"maox_info: The ConnectionManager does not know any connection of this name.",
"No connection named 'does-not-exist' present."}, "\n");
assertEqual(lasterror().message, expected_msg)
strjoin({"maox_info: The ConnectionManager does not know any connection of this name.", ...
"No connection named 'does-not-exist' present."}, "\n");
assertEqual(lasterror().message, expected_msg);
end
function info = non_existing_connection()
c = Caosdb(connection = "does-not-exist");
c = Caosdb("does-not-exist");
info = c.info();
end
......@@ -102,4 +120,3 @@ function test_retrieve_failure()
assertExceptionThrown(@()c.retrieve({"120"}, {120}), "maox:InvalidArgument");
assertExceptionThrown(@()c.retrieve({"120"}, {"120", 120}), "maox:InvalidArgument");
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment