Commit abb5cf0
committed
Test whether functions preserve names (cf #575).
Principles:
- Preserve names where the output has a 1-to-1 correspondence with the input.
- Preserve names for functions where base behavior suggests keeping names (e.g., grepl/grep(value=TRUE), sort/unique).
- Source of names: use names from the primary `string` argument only; ignore names on `pattern`/`replacement`/others and never merge.
- For 1-row-per-input matrices/lists (e.g., str_locate/str_match/str_split_fixed), set row/list names from input names.
- Don't preserve names where strings are combined, or the return values are indices
(e.g., str_c, str_flatten, str_glue, str_which, str_order, str_equal).
Currently passing:
- str_subset
- str_trunc
Currently failing:
- str_count
- str_detect
- str_starts
- str_ends
- str_like
- str_escape
- str_replace
- str_remove
- str_conv
- str_trim
- str_pad
- str_sub
- str_to_lower
- str_to_upper
- str_to_title
- str_extract
- str_locate
- str_match
- str_extract_all
- str_locate_all
- str_match_all
- str_split
- str_split_fixed
- str_split_i
- str_sub_all
- str_length
- str_width
- str_dup
- word
- str_unique
- str_replace_na
- str_sort
- str_wrap
- str_replace_all1 parent 90f8ba7 commit abb5cf0
1 file changed
+89
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
0 commit comments