Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
3 posts • Page 1 of 1
3 posts
• Page 1 of 1
christian.kotz@siemens.com
Posts:14
Joined: Tue Aug 07, 2018 5:11 pm
Feature Request
Postby christian.kotz@siemens.com »
HI,
It would be convenient, if it where possible to unit test private functions in CONTROL scripts, where the unit tests reside in files other than the source code file that contains the private function.
I would suggest to add a friend file declaration to the language, e.g:
#friend "unitTests/filXy.ctl"
What do you think?
Is there already another approch to unit test private functions?
currently there is no way of doing so.
But if we add such a feature, I'd rather go with the C++ way using friend as a keyword in the class declaring another function/class as friend.
C++ this is less of a problem, there is a preprocessor and private can be redefined with -Dprivate=public in unit tests, if there is no friend declaration)
In scripts it is not advisable to have the unit tests in production code, particular since scripts are interpreted, not compiled (huge source file, besides poor separation of test and produc
It would came very handy if unit testing (to the level of private functions) would still be possible in scrtipts.
Since access specifiers in CONTROL work on a file level (like in Java) it would be consequent to stay on the file level.
If going for the C++ way file private publich should be deprecated in my opinion.
Note that WinCC OA does not support namespaces and friend function / classes are more likely end up in unintended befriendinf in a large project.