It does, however your subsequent code might crash because of this and obviously once crashed theres no way to go forward. So if your code assumes thet theres a return then your code is wrong. Put it inside a try block.
But yes its extremely easy to test.
if(size(lsUI -windows
)==0)
print ("then i have no GUI, and am in batch mode")
yes, you can point the user profile elsewhere with environment variables, either so the user setup is not seen or tahta empty one gets run. Oh this only works in windows and linux but not on mac.
you cam also jsut rename te user setup, or change how it gets called in the main mel code.
PS: dont assume test!