File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -684,8 +684,9 @@ def append(object)
684
684
modifying!
685
685
tuple = input_to_tuple object
686
686
entry = tuple_to_str tuple
687
+ string unless empty? # write @string before tuple_add
687
688
tuple_add tuple
688
- @string = -( string ? "#{ @string } ,#{ entry } " : entry )
689
+ @string = -( @ string ? "#{ @string } ,#{ entry } " : entry )
689
690
self
690
691
end
691
692
Original file line number Diff line number Diff line change @@ -344,6 +344,14 @@ def obj.to_sequence_set; 192_168.001_255 end
344
344
assert_equal "1:6,4:9" , SequenceSet . new ( "1:6" ) . append ( "4:9" ) . string
345
345
assert_equal "1:4,5:*" , SequenceSet . new ( "1:4" ) . append ( 5 ..) . string
346
346
assert_equal "5:*,1:4" , SequenceSet . new ( "5:*" ) . append ( 1 ..4 ) . string
347
+ # also works from empty
348
+ assert_equal "5,1" , SequenceSet . new . append ( 5 ) . append ( 1 ) . string
349
+ # also works when *previously* input was non-strings
350
+ assert_equal "*,1" , SequenceSet . new ( :* ) . append ( 1 ) . string
351
+ assert_equal "1,5" , SequenceSet . new ( 1 ) . append ( "5" ) . string
352
+ assert_equal "1:6,4:9" , SequenceSet . new ( 1 ..6 ) . append ( 4 ..9 ) . string
353
+ assert_equal "1:4,5:*" , SequenceSet . new ( 1 ..4 ) . append ( 5 ..) . string
354
+ assert_equal "5:*,1:4" , SequenceSet . new ( 5 ..) . append ( 1 ..4 ) . string
347
355
end
348
356
349
357
test "#merge" do
You can’t perform that action at this time.
0 commit comments