Hello, J T.
Thanks for your answer. Indeed this works. Additional note: the casing of guard macro is not important, i.e. one can use either "testH" or "TESTH" or "testh" in the example above (but no underscores etc.)
Though, the hole thing is not very good for me, because I have some source base, which I have to adapt to C++Builder and this source base has different convention for naming guards. So I either have to change the guard names for all header files or to give up the idea of using units (and use separate header and source files included to the project, which is not too convenient as I cannot switch between them easily).
After all, I don't understand, why guard name influence if the header is detected as part of the unit? Guard name is the only property of the header itself and does not connect it to the source file in any way. So, why not just check the file name of the header? Or why not to make it possible to set up the unit manually? But probably I miss some point.
Anyway, thanks again for the answer. At least now I know why it did not work for me from the very beginning.