mirror of
https://github.com/rbenv/rbenv.git
synced 2024-12-29 13:15:42 +01:00
Add more tests for version-file-read
This commit is contained in:
parent
3300587c6b
commit
d2eace00c9
1 changed files with 27 additions and 0 deletions
|
@ -17,12 +17,24 @@ setup() {
|
|||
assert_failure ""
|
||||
}
|
||||
|
||||
@test "fails for blank file" {
|
||||
echo > my-version
|
||||
run rbenv-version-file-read my-version
|
||||
assert_failure ""
|
||||
}
|
||||
|
||||
@test "reads simple version file" {
|
||||
cat > my-version <<<"1.9.3"
|
||||
run rbenv-version-file-read my-version
|
||||
assert_success "1.9.3"
|
||||
}
|
||||
|
||||
@test "ignores leading spaces" {
|
||||
cat > my-version <<<" 1.9.3"
|
||||
run rbenv-version-file-read my-version
|
||||
assert_success "1.9.3"
|
||||
}
|
||||
|
||||
@test "reads only the first word from file" {
|
||||
cat > my-version <<<"1.9.3-p194@tag 1.8.7 hi"
|
||||
run rbenv-version-file-read my-version
|
||||
|
@ -37,3 +49,18 @@ IN
|
|||
run rbenv-version-file-read my-version
|
||||
assert_success "1.8.7"
|
||||
}
|
||||
|
||||
@test "ignores leading blank lines" {
|
||||
cat > my-version <<IN
|
||||
|
||||
1.9.3
|
||||
IN
|
||||
run rbenv-version-file-read my-version
|
||||
assert_success "1.9.3"
|
||||
}
|
||||
|
||||
@test "handles the file with no trailing newline" {
|
||||
echo -n "1.8.7" > my-version
|
||||
run rbenv-version-file-read my-version
|
||||
assert_success "1.8.7"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue