Skip to content

asserting lines that do not exist should cause an error #74

@samuel12sam

Description

@samuel12sam
@test "simple test" {
    bats_require_minimum_version 1.5.0
    run --keep-empty-lines echo 'hello'
    assert_success
    echo "Line count: ${#lines[@]}"

    [ "${#lines[@]}" -eq 1 ]
    assert_line -n 0 'hello'
    assert_line -n 1 ''
    assert_line -n 2 ''
    assert_line -n 99 ''
}

I would expect asserting lines that do not exist to fail, even though we assert them with '' (empty string).

Shouldn't there be some sort of automatic check that looks if the line id you're asserting is >= line count when using assert_line ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions