I need to have a file input that can be executed as both - main for output, and a module for unit testing(because apparently you can't run tests again main.swift).
Let's say I have a file like this:
class Hello {}
#if RELEASE
print("hello")
#endif
Now, the idea here is that I can put this input into either a main.swift or something.swift and use a flag to remove the print("hello") when not in main.swift.
But it seems that no matter what I still get the error:
error: expressions are not allowed at the top level print("hello")
Is it possible to achieve what I want with the flags, or there's something weird going?