File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ def annotate(annotation)
218218 end
219219
220220 def description
221- @object_name ||= "#{ self . class } :0x #{ object_id . to_s ( 16 ) } #{ @transient ? ' transient' : nil } "
221+ @object_name ||= "#{ self . class } :#{ format '%#018x' , object_id } #{ @transient ? ' transient' : nil } "
222222
223223 if @annotation
224224 "#{ @object_name } #{ @annotation } "
Original file line number Diff line number Diff line change 6262 expect ( lines [ 1 ] ) . to be =~ /\t #<Async::Node:0x\h +>\n /
6363 end
6464 end
65+
66+ describe '#inspect' do
67+ let ( :node ) { Async ::Node . new }
68+
69+ it 'should begin with the class name' do
70+ expect ( node . inspect ) . to start_with "#<#{ node . class . name } "
71+ end
72+
73+ it 'should end with hex digits' do
74+ expect ( node . inspect ) . to match ( /\h >\z / )
75+ end
76+
77+ it 'should have a standard number of hex digits' do
78+ expect ( node . inspect ) . to match ( /:0x\h {16}>/ )
79+ end
80+
81+ it 'should have a colon in the middle' do
82+ name , middle , hex = node . inspect . rpartition ( ':' )
83+
84+ expect ( name ) . to end_with node . class . name
85+ expect ( middle ) . to eq ':'
86+ expect ( hex ) . to match ( /\A \h +/ )
87+ end
88+ end
6589
6690 describe '#consume' do
6791 it "can't consume middle node" do
You can’t perform that action at this time.
0 commit comments