|
416 | 416 | <error/vctrs_error_subscript_oob>
|
417 | 417 | Error:
|
418 | 418 | ! Can't subset elements with `3`.
|
419 |
| - i Input has size 1. |
420 |
| - x Subscript `3` contains non-consecutive location 3. |
| 419 | + x Location must be less than or equal to 1, not 3. |
| 420 | + i There is only 1 element. |
| 421 | + i Extension with consecutive locations is allowed. |
421 | 422 | Code
|
422 | 423 | (expect_error(num_as_location(c(1, 3), 1, oob = "extend"), class = "vctrs_error_subscript_oob")
|
423 | 424 | )
|
424 | 425 | Output
|
425 | 426 | <error/vctrs_error_subscript_oob>
|
426 | 427 | Error:
|
427 | 428 | ! Can't subset elements with `c(1, 3)`.
|
428 |
| - i Input has size 1. |
429 |
| - x Subscript `c(1, 3)` contains non-consecutive location 3. |
| 429 | + x Location must be less than or equal to 1. |
| 430 | + i There is only 1 element. |
| 431 | + i Extension with consecutive locations is allowed. |
430 | 432 | Code
|
431 | 433 | (expect_error(num_as_location(c(1:5, 7), 3, oob = "extend"), class = "vctrs_error_subscript_oob")
|
432 | 434 | )
|
433 | 435 | Output
|
434 | 436 | <error/vctrs_error_subscript_oob>
|
435 | 437 | Error:
|
436 | 438 | ! Can't subset elements with `c(1:5, 7)`.
|
437 |
| - i Input has size 3. |
438 |
| - x Subscript `c(1:5, 7)` contains non-consecutive locations 4 and 7. |
| 439 | + x Locations must be less than or equal to 3. |
| 440 | + i There are only 3 elements. |
| 441 | + i Extension with consecutive locations is allowed. |
439 | 442 | Code
|
440 | 443 | (expect_error(num_as_location(c(1:5, 7, 1), 3, oob = "extend"), class = "vctrs_error_subscript_oob")
|
441 | 444 | )
|
442 | 445 | Output
|
443 | 446 | <error/vctrs_error_subscript_oob>
|
444 | 447 | Error:
|
445 | 448 | ! Can't subset elements with `c(1:5, 7, 1)`.
|
446 |
| - i Input has size 3. |
447 |
| - x Subscript `c(1:5, 7, 1)` contains non-consecutive locations 4 and 7. |
| 449 | + x Locations must be less than or equal to 3. |
| 450 | + i There are only 3 elements. |
| 451 | + i Extension with consecutive locations is allowed. |
448 | 452 | Code
|
449 | 453 | (expect_error(class = "vctrs_error_subscript_oob", num_as_location(c(1:5, 7, 1,
|
450 | 454 | 10), 3, oob = "extend")))
|
451 | 455 | Output
|
452 | 456 | <error/vctrs_error_subscript_oob>
|
453 | 457 | Error:
|
454 | 458 | ! Can't subset elements with `c(1:5, 7, 1, 10)`.
|
455 |
| - i Input has size 3. |
456 |
| - x Subscript `c(1:5, 7, 1, 10)` contains non-consecutive locations 4, 7, and 10. |
| 459 | + x Locations must be less than or equal to 3. |
| 460 | + i There are only 3 elements. |
| 461 | + i Extension with consecutive locations is allowed. |
457 | 462 |
|
458 | 463 | # num_as_location() errors when inverting oob negatives unless `oob = 'remove'` (#1630)
|
459 | 464 |
|
|
553 | 558 | <error/vctrs_error_subscript_oob>
|
554 | 559 | Error:
|
555 | 560 | ! Can't subset elements with `c(1, NA, 3)`.
|
556 |
| - i Input has size 1. |
557 |
| - x Subscript `c(1, NA, 3)` contains non-consecutive location 3. |
| 561 | + x Location must be less than or equal to 1. |
| 562 | + i There is only 1 element. |
| 563 | + i Extension with consecutive locations is allowed. |
558 | 564 |
|
559 | 565 | # can disallow missing values
|
560 | 566 |
|
|
778 | 784 | <error/vctrs_error_subscript_oob>
|
779 | 785 | Error in `my_function()`:
|
780 | 786 | ! Can't subset elements with `foo`.
|
781 |
| - i Input has size 2. |
782 |
| - x Subscript `foo` contains non-consecutive location 4. |
| 787 | + x Location must be less than or equal to 2. |
| 788 | + i There are only 2 elements. |
| 789 | + i Extension with consecutive locations is allowed. |
783 | 790 | Code
|
784 | 791 | (expect_error(num_as_location(0, 1, zero = "error", arg = "foo", call = call(
|
785 | 792 | "my_function")), class = "vctrs_error_subscript_type"))
|
|
863 | 870 | <error/vctrs_error_subscript_oob>
|
864 | 871 | Error:
|
865 | 872 | ! Can't rename columns with `foo(bar)`.
|
866 |
| - i Input has size 2. |
867 |
| - x Subscript `foo(bar)` contains non-consecutive location 4. |
| 873 | + x Location must be less than or equal to 2. |
| 874 | + i There are only 2 columns. |
| 875 | + i Extension with consecutive locations is allowed. |
868 | 876 | Code
|
869 | 877 | (expect_error(with_tibble_cols(num_as_location(0, 1, zero = "error")), class = "vctrs_error_subscript_type")
|
870 | 878 | )
|
|
0 commit comments