-
Notifications
You must be signed in to change notification settings - Fork 165
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
Set start of 'ok' and improve check of empty 'file' string #4405
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this, and those testing functions in general.
To me it indicates a mixup of two different testing variants:
Basically the functions internally assert if there is a failure, and always set ok to true at the end. Some (as this proposed one) set ok to false in the beginning, but I don't see the benefit - either the assert triggers and then it stops and the return value isn't relevant, or the assert doesn't trigger and it returns true.
I would either remove the asserts (probably not) or the return value.
The file part likely didn't work before, and the change doesn't help.
The correct solution would be:
if Modelica.Utilities.Strings.isEmpty(logFile) then
file:="";
else
file:=Modelica.Utilities.Files.fullPathName(logFile);
print("... testAllFunctions(..) is logged in " + file);
Modelica.Utilities.Files.removeFile(file);
end if;
So, that you send in an empty logfile if you don't want log-files, whereas fullPathName of "" may return the local directory!
Alternatively just don't change 'ok'. |
BTW: Why is I thought the other commands also handled relative paths as well, and only So, just:
or back to:
and replace |
@HansOlsson Well, I didn't digger deeply in this function. The PR is only about to handle empty string of |
But there are some problems:
So the PR isn't that bad in itself - it just made me realize how messy the function really is. |
@HansOlsson I fully agree to all your three concerns.
So I prefer retrieve this PR. Changing the function as you suggest is all fine but shall be done in a new PR. |
No description provided.