
Unnamed vector with character subscript
=======================================

> vec_slice(1:3, letters[1])
Error: Can't use character names to index an unnamed vector.


Negative subscripts are checked
===============================

> vec_slice(1:3, -c(1L, NA))
Error: Must subset elements with a valid subscript vector.
x Negative locations can't have missing values.
i Subscript has a missing value at location 2.

> vec_slice(1:3, c(-1L, 1L))
Error: Must subset elements with a valid subscript vector.
x Negative and positive locations can't be mixed.
i Subscript has a positive value at location 2.


oob error messages are properly constructed
===========================================

> vec_slice(c(bar = 1), "foo")
Error: Can't subset elements that don't exist.
x Element `foo` doesn't exist.

> # Multiple OOB indices
> vec_slice(letters, c(100, 1000))
Error: Can't subset elements that don't exist.
x Locations 100 and 1000 don't exist.
i There are only 26 elements.

> vec_slice(letters, c(1, 100:103, 2, 104:110))
Error: Can't subset elements that don't exist.
x Locations 100, 101, 102, 103, 104, etc. don't exist.
i There are only 26 elements.

> vec_slice(set_names(letters), c("foo", "bar"))
Error: Can't subset elements that don't exist.
x Elements `foo` and `bar` don't exist.

> vec_slice(set_names(letters), toupper(letters))
Error: Can't subset elements that don't exist.
x Elements `A`, `B`, `C`, `D`, `E`, etc. don't exist.


Can't index beyond the end of a vector
======================================

> vec_slice(1:2, 3L)
Error: Can't subset elements that don't exist.
x Location 3 doesn't exist.
i There are only 2 elements.

> vec_slice(1:2, -3L)
Error: Can't negate elements that don't exist.
x Location 3 doesn't exist.
i There are only 2 elements.


vec_slice throws error with non-vector subscripts
=================================================

> vec_slice(1:3, Sys.Date())
Error: Must subset elements with a valid subscript vector.
x Subscript has the wrong type `date`.
i It must be logical, numeric, or character.

> vec_slice(1:3, matrix(TRUE, ncol = 1))
Error: Must subset elements with a valid subscript vector.
x Subscript must be a simple vector, not a matrix.

