tests: Add expect_* and assert_* functions

This commit adds some useful functions which can substitute common
patterns existing in tests, eg:

if ! some_command [args]... ; then
  test_fail "blah blah blah"
fi