Skip to content

Commit

Permalink
Fixes: #8075
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducasse committed Dec 13, 2020
1 parent 49b5de9 commit ecfcf07
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Text-Core/RunArray.class.st
Expand Up @@ -187,6 +187,14 @@ RunArray >> = otherArray [
and: [values hasEqualElements: otherArray values]
]

{ #category : #adding }
RunArray >> add: newObject [
"Include newObject as one of the receiver's elements. Answer newObject.
ArrayedCollections cannot respond to this message."

^ self addLast: newObject
]

{ #category : #adding }
RunArray >> add: newObject withOccurrences: anInteger [
"Add value as the last element of the receiver, the given number of times"
Expand Down
28 changes: 28 additions & 0 deletions src/Text-Tests/RunArrayTest.class.st
Expand Up @@ -12,6 +12,34 @@ RunArrayTest >> testANewRunArrayIsEmpty [
self assertEmpty: RunArray new
]

{ #category : #'tests - adding' }
RunArrayTest >> testAdd [

| run |
run := RunArray new.
self assert: run size equals: 0.

run add: $A.
self assert: run size equals: 1.
run add: $A.
self assert: run size equals: 2.
run add: $B.
self assert: run size equals: 3.
]

{ #category : #'tests - adding' }
RunArrayTest >> testAddAddsAsLastElement [

| run |
run := RunArray new.
self assert: run size equals: 0.

run add: $A.
run add: $A.
run add: $B.
self assert: (run at: 3) equals: $B
]

{ #category : #'tests - accessing' }
RunArrayTest >> testAt [

Expand Down

0 comments on commit ecfcf07

Please sign in to comment.