resourceloader: Consistently set state=ready after script execution (not before)
For the case of 'module.script' being an array, mw.loader already sets state=ready
after execution. For the cases of it being a function or string, we were setting
state=ready before execution.
This looks like it may have intended to prevent double execution where e.g.
some other module may need this module and see it has state 'loading' and start
executing it. However ResourceLoader doesn't expose execute(). The only code
calling execute() is code that also sets 'state=loading', or handlePending.
In fact, this early setting of "ready" could actually cause double execution.
Not of the current module, but of dependent modules. If a module's script loads
other modules that are cache hits, that could may trigger handlePending() which
will assume the current module to be ready, when it isn't.
Now that these code paths match, re-use the markModuleReady callback instead of
repeating this code.
Update tests:
* Make assertion captions less verbose.
* Change load instruction from "test.implement" to "test.implement.import".
Module "test.implement" doesn't exist. This worked by accident because
implement() can sometimes run a module immediately if it doesn't exist.
* Update test to reflect internal detail that state=loading during script
execution.
* Assert afterwards that script ran and state=ready.
Change-Id: I6b0542edb113d58b8f24cc8587e98ee88b514c55