Commit 87b1631
Add specs for Kernel#p return values
Kernel#p's return value had no coverage for 3 scenarios:
- nil for no arguments
- the argument itself (not a 1-element Array) for a single argument
- a new Array for multiple arguments
That passthrough is what lets `p` be used inline where `puts` cannot, since `puts` always returns nil.
The nil cases are asserted on the existing "prints nothing" examples, as `core/io/puts_spec.rb` does for IO#puts. The passthrough cases get their own examples, as `core/io/output_spec.rb` does for IO#<<. Specs are under Kernel#p only, following a1f57e8.
Matchers follow #1350 (.should == nil, .should.equal?).1 parent bb3e38b commit 87b1631
1 file changed
Lines changed: 23 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
77 | 98 | | |
78 | 99 | | |
79 | 100 | | |
| |||
0 commit comments