Skip to content

Commit aacc9b2

Browse files
committed
Update tests and docs for accessor methods
Since Ruby 3.1, TracePoint can now handle events for accessor methods.
1 parent 569ef85 commit aacc9b2

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,19 @@ assert do
6161
end
6262
```
6363

64-
* Returned values from accessor methods, method missing, or "super" produce nothing report, e.g:
64+
* Returned values from method missing, or "super" produce nothing report, e.g:
6565

6666
```ruby
6767
class Foo
68-
attr_accessor :val
68+
def method_missing(*)
69+
:foo
70+
end
6971
end
7072
foo = Foo.new
71-
foo.val = false
72-
73-
assert do
74-
# reported (only the value of "foo" and the literal "true")
75-
foo.val == true
76-
end
7773

7874
assert do
7975
# won't be reported
80-
foo.val
76+
foo.foo
8177
end
8278
```
8379

test/block_test.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -285,21 +285,14 @@ def inspect; '#<Class>'; end
285285
end
286286

287287
t do
288-
older = <<END.chomp
289-
@obj.to_i.to_i.to_s
290-
| |
291-
| "0"
292-
#<Class>
293-
END
294-
newer = <<END.chomp
288+
assert_equal <<END.chomp, assertion_message {
295289
@obj.to_i.to_i.to_s
296290
| | | |
297291
| | | "0"
298292
| | 0
299293
| 0
300294
#<Class>
301295
END
302-
assert_includes [older, newer], assertion_message {
303296
@obj.to_i.to_i.to_s
304297
}
305298
end

0 commit comments

Comments
 (0)