|
| 1 | +# {{TEST}} |
1 | 2 | # frozen_string_literal: true |
2 | 3 |
|
3 | | -module Bar # BUG: The contexts here include too many newlines |
4 | | - class Foo |
5 | | - class << self |
6 | | - def run |
| 4 | +# BUG: The contexts need newlines or they don't appear |
7 | 5 |
|
| 6 | +# Comment before module starts |
| 7 | +module Bar # {{CONTEXT}} |
| 8 | + # Comment after module starts |
8 | 9 |
|
9 | 10 |
|
| 11 | + # {{CURSOR}} |
| 12 | + # Comment before class starts |
| 13 | + class Foo # {{CONTEXT}} |
| 14 | + # Comment after class starts |
10 | 15 |
|
11 | | - if false |
12 | | - (20..30).each do |element| |
13 | | - block.call(element) |
14 | | - end |
15 | | - else |
16 | | - 1 + 1 |
17 | | - end |
18 | | - end |
19 | | - end |
20 | 16 |
|
21 | | - def self.other_method |
22 | | - unless false |
23 | | - (10..20).each do |element| |
24 | | - block.call(element) |
25 | | - end |
26 | | - else |
27 | | - 1 + 1 |
28 | | - end |
29 | | - end |
| 17 | + # {{CURSOR}} |
| 18 | + # Comment before singleton class starts |
| 19 | + class << self # {{CONTEXT}} |
| 20 | + # Comment after singleton class starts |
30 | 21 |
|
31 | | - def run(&block) |
32 | | - unless false |
33 | | - (1..10).each do |element| |
34 | | - block.call(element) |
35 | | - end |
36 | | - else |
37 | | - 1 + 1 |
| 22 | + |
| 23 | + # {{CURSOR}} |
| 24 | + # Comment before method starts |
| 25 | + def run # {{CONTEXT}} |
| 26 | + # Comment after method starts |
| 27 | + |
| 28 | + |
| 29 | + # {{CURSOR}} |
| 30 | + if false # {{CONTEXT}} |
| 31 | + # Comment after if starts |
| 32 | + |
| 33 | + |
| 34 | + # {{CURSOR}} |
| 35 | + (20..30).each do |element| # {{CONTEXT}} |
| 36 | + # Comment after block starts |
| 37 | + |
| 38 | + |
| 39 | + block.call(element) # {{CURSOR}} |
| 40 | + end # {{POPCONTEXT}} |
| 41 | + else # {{CONTEXT}} |
| 42 | + # Comment after else starts |
| 43 | + |
| 44 | + |
| 45 | + 1 + 1 #{{CURSOR}} |
| 46 | + end # {{POPCONTEXT}} |
| 47 | + end # {{POPCONTEXT}} |
| 48 | + end # {{POPCONTEXT}} |
| 49 | + # {{POPCONTEXT}} # XXX: Extra pop to pop the else context |
| 50 | + |
| 51 | + # Comment before singleton method |
| 52 | + def self.other_method # {{CONTEXT}} |
| 53 | + # Comment after singleton method starts |
| 54 | + |
| 55 | + |
| 56 | + # {{CURSOR}} |
| 57 | + unless false # {{CONTEXT}} |
| 58 | + # Comment after unless starts |
| 59 | + |
| 60 | + |
| 61 | + # {{CURSOR}} |
| 62 | + (10..20).each do |element| # {{CONTEXT}} |
| 63 | + # Comment after block starts |
| 64 | + |
| 65 | + |
| 66 | + block.call(element) # {{CURSOR}} |
| 67 | + end # {{POPCONTEXT}} |
| 68 | + else # {{CONTEXT}} |
| 69 | + # Comment after else starts |
| 70 | + |
| 71 | + |
| 72 | + 1 + 1 # {{CURSOR}} |
| 73 | + end # {{POPCONTEXT}} |
| 74 | + end # {{POPCONTEXT}} |
| 75 | + # {{POPCONTEXT}} # XXX: Extra pop to pop the else context |
| 76 | + |
| 77 | + # Comment before method starts |
| 78 | + def run(&block) # {{CONTEXT}} |
| 79 | + # Comment after method starts |
| 80 | + |
| 81 | + |
| 82 | + # {{CURSOR}} |
| 83 | + unless false # {{CONTEXT}} |
| 84 | + # Comment after unless starts |
| 85 | + |
| 86 | + |
| 87 | + # {{CURSOR}} |
| 88 | + (1..10).each do |element| # {{CONTEXT}} |
| 89 | + # Comment after block starts |
| 90 | + |
| 91 | + |
| 92 | + block.call(element) # {{CURSOR}} |
| 93 | + end # {{POPCONTEXT}} |
| 94 | + else # {{CONTEXT}} |
| 95 | + # Comment after else starts |
| 96 | + |
| 97 | + |
| 98 | + 1 + 1 # {{CURSOR}} |
38 | 99 | end |
39 | 100 | end |
40 | 101 | end |
41 | 102 | end |
42 | 103 |
|
| 104 | +# {{TEST}} |
| 105 | + |
43 | 106 | RSpec.describe 'foo' do # {{CONTEXT}} |
44 | 107 | context 'bar' do # {{CONTEXT}} |
45 | 108 | shared_context 'shared context' do # {{CONTEXT}} |
|
0 commit comments