# Run with ./run-tests.sh

test_extra_arguments() {
    cat > test.py <<-EOF
	import sys
	assert sys.argv[1:] == ["a", "b c"]
	EOF
    stbt-run -v test.py a "b c"
}

test_script_accesses_its_path() {
    touch module.py
    cat > test.py <<-EOF
	import module
	print '__file__: ' + __file__
	assert __file__ == "test.py"
	EOF
    stbt-run -v test.py
}

# Run with ./run-tests.sh

test_extra_arguments() {
    cat > test.py <<-EOF
	import sys
	assert sys.argv[1:] == ["a", "b c"]
	EOF
    stbt-run -v test.py a "b c" &&
    stbt-run -v test.py -- a "b c"
}

test_script_accesses_its_path() {
    touch module.py
    cat > test.py <<-EOF
	import module
	print '__file__: ' + __file__
	assert __file__ == "test.py"
	EOF
    stbt-run -v test.py
}

Test "--" argument to stbt-run
test_extra_arguments: Test "--" argument to stbt-run

Commit bf393c1d allowed users to pass arguments to the test script on
the stbt-run command line. You can put a "--" between the normal
stbt-run flags and these extra arguments, and the "--" isn't passed on
to the user script. This wasn't documented in bf393c1d, but it's just
the behaviour of python's argparse. This test documents that behaviour,
which is relied on by the next commit.
