Commit b7f745a
committed
Refactor unparser specs to accommodate assertions against non-default parser/builder options
This commit refactors the specs in two ways:
1. Accommodate non-default parser/builder options such
as `emit_file_line_as_literals`
For example, specifying parser builder options:
with_builder_options({ emit_file_line_as_literals: true }) do
assert_generates '__FILE__', '"(string)"'
assert_generates '__LINE__', '1'
end
with_builder_options({ emit_file_line_as_literals: false }) do
assert_source '__FILE__'
assert_source '__LINE__'
end
2. Simpler accommodation for future Ruby changes so assertions can easily
be targeted at versions of Ruby after a certain version or prior
to a certain version. For example, when 2.4 is added, we can block
certain behavior to end at 2.3, and other behavior to start at 2.4.
For example, specifying Ruby versions for particular assertions.
with_ruby_versions(beginning_at: '2.3') do
assert_terminated 'a&.b'
assert_terminated 'a&.b(c)'
end
with_ruby_versions(only: '2.3') do
# ... asertions
end
with_ruby_versions(ending_at: '2.3') do
# ... assertions
end1 parent bf07696 commit b7f745a
2 files changed
Lines changed: 93 additions & 20 deletions
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
14 | 15 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 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 | + | |
18 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
19 | 50 | | |
20 | 51 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
24 | 74 | | |
25 | 75 | | |
26 | 76 | | |
| |||
50 | 100 | | |
51 | 101 | | |
52 | 102 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
57 | 107 | | |
58 | 108 | | |
59 | | - | |
60 | | - | |
| 109 | + | |
| 110 | + | |
61 | 111 | | |
62 | 112 | | |
63 | 113 | | |
| |||
69 | 119 | | |
70 | 120 | | |
71 | 121 | | |
72 | | - | |
73 | | - | |
| 122 | + | |
| 123 | + | |
74 | 124 | | |
75 | 125 | | |
76 | 126 | | |
77 | 127 | | |
78 | 128 | | |
79 | 129 | | |
80 | | - | |
81 | | - | |
| 130 | + | |
| 131 | + | |
82 | 132 | | |
83 | 133 | | |
84 | 134 | | |
| |||
408 | 458 | | |
409 | 459 | | |
410 | 460 | | |
411 | | - | |
412 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
413 | 465 | | |
414 | 466 | | |
415 | 467 | | |
| |||
0 commit comments