There really is no such thing as WORA (write once, run anywhere). Seriously. That's the big dream of HTML5, but due to the number of browser vendors even that dream will be tainted by the time it becomes realised in the larger sense. Tainted not just by functional differences (compositing is one extant example) but also by performance differences. In the meantime, these issues already exist.
For now, for a simple 2D game, you really still can't do much better than Flash/AS3. It has ASUnit, based on JUnit.
Java's another option, and while I love the language itself, Java deployment, particularly to the web, is depressing and was one of the reasons Java, which had all the potential Flash had and far, far more, never made it big on the web games scene. Also, Android uses Dalvik, which is a proprietary version of the JVM -- not really the same thing. So Android at least would be out of the picture, unless you ported your Java code across platforms... which is what you wish to avoid. ;) Java obviously has JUnit (the unit testing framework). If going for Java, check out PulpCore for a fast software renderer; the scene graph / display list approach they use is almost identical to using the AS3 core.
Silverlight's a joke in this sense, it's not even near universally cross-platform.
You can also check out SDL -- I believe it's not a half bad option in this regard. I'm using it but I haven't gotten as far as cross-platform deployment yet. However, writing cross-platform C/C++ code is not quite the same as a Flash or Unity codebase which is totally platform-agnostic, for those platforms it does support (most).
You can see why whenever this matter is brought up, people suggest Unity. The fact is, it's probably the most cross-platform solution out there, being even better in that regard than Flash (iOS).