move test to a right location
Skip chdir and setting $0 when source is given as a script
Fix docs