Install function for testing

Following discussions about testing the install script and @ljharb's will to have many small pull requests, here's the first one :)

What it does:

* wraps the code of the `install.sh` that was actually performing the install into a function
* The function is executed at install but __not__ during tests
* First test for the install script (_is the function defined?_)


I don't think `exit` is a safe thing to use here - can we do this instead:
```
! safe_type nvm_do_install && \
  ! safe_type nvm_has && \
  ! safe_type nvm_download && \
  ! safe_type install_nvm_as_script && \
  ! safe_type install_nvm_from_git && \
  ! safe_type nvm_reset
```

Also, note `s/safe_install_nvm_as_script/install_nvm_as_script`.