
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 The 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 locations can't be mixed with positive locations.
i The 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 The element `foo` doesn't exist.

> # Multiple OOB indices
> vec_slice(letters, c(100, 1000))
Error: Can't subset elements that don't exist.
x The 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 The 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 The elements `foo` and `bar` don't exist.

> vec_slice(set_names(letters), toupper(letters))
Error: Can't subset elements that don't exist.
x The 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 The 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 The location 3 doesn't exist.
i There are only 2 elements.

