EDIT: Warning - Long answer from self-taught ahead.,.
In my very humble opinion (I am GENERAL TRAINING here) it seems that BonyT and Daniel T. are on the right track. A part that may not be here is part of the design. Although it is safe to say that refactoring / compilation will always be a necessity, can it be just as safe to say that the proper design (ESPECIALLY with beginners!) Would be the first, second and third steps for properly compiled code?
While I get what you ask for (test / test suite for compiling code), I think that BonyT applies the earliest of these tests during the "pseudo-code" part of the design process, isn't it?
Obviously, in the early stages of project planning, strong design and experienced coders will sniff out the obvious places ripe for composition. As the work progresses and the team begins to fill these source code stubs with the body, some slightly dumber outer members inevitably arise. The BonyT example shows these first two steps quite well.
I think there comes a moment when experience comes and a finely tuned "nose" for the smell of code - in other words, a part that you may not be able to learn directly. However, that is where Daniel T's answer comes in — although it is not possible to develop specific “tests” such as ACIDs for the right composition, methods such as Daniel can be used to find potential smelly code. Discover the "clues" if you want, this should at least trigger further investigation.
If someone is not sure that things are made up to the mark, it might make sense to work through a certain function and try to describe in stages what happens in simple single sentences without conjunctions. This is probably the most basic ACID type test that can be performed. Not to mention that by default this process will correctly document the code.,.
In response to BonyT, you mean that its fragments of the pseudocode / method make the next step obvious: I'm sure that if someone goes through the function and describes things step by step, it often turns out that in fact the next step obviously follows at one level of detail or belongs in another place. Although there will obviously be cases (many with complex code) where things are not so neat, I suggest that this only happens with experience (and possibly with genetics!), Again, things that you cannot teach directly . At this point, you need to study the problem area and determine the solution that best matches the domain (and also be prepared to change it along the way). Once again, correctly documenting the “intermediate” cases with short, simple statements (and a narrative describing solutions in gray areas) will help the poor maintenance guy in the future.
I understand that I did not offer anything new here, but what I had to say was longer than the comment would allow!