Skip to content
Permalink
Browse files

Implemented #register:after: and #register:before: with corresponding…

… unit tests.
  • Loading branch information...
juliendelplanque committed Jun 25, 2019
1 parent 5c91fac commit ad5041cccdd34a7b021ca505323ce6d9a5912480
Showing with 37 additions and 2 deletions.
  1. +33 −0 src/Commander2-Tests/CmCommandGroupTest.class.st
  2. +4 −2 src/Commander2/CmCommandGroup.class.st
@@ -100,6 +100,38 @@ CmCommandGroupTest >> testInitialize [
self assert: newGroup entries isEmpty
]

{ #category : #test }
CmCommandGroupTest >> testRegisterAfter [
| command |
command := CmBlockCommand new
basicName: 'added after command';
block: [ :x | x ];
context: [ 1 ];
yourself.

self assert: group entries third equals: subGroup2.

group register: command after: subGroup1.
self deny: group entries third equals: subGroup2.
self assert: group entries third equals: command.
]

{ #category : #test }
CmCommandGroupTest >> testRegisterBefore [
| command |
command := CmBlockCommand new
basicName: 'added before command';
block: [ :x | x ];
context: [ 1 ];
yourself.

self assert: group entries second equals: subGroup1.

group register: command before: subGroup1.
self deny: group entries second equals: subGroup1.
self assert: group entries second equals: command.
]

{ #category : #test }
CmCommandGroupTest >> testRegisterCommandWithContext [
| secondCommand |
@@ -171,6 +203,7 @@ CmCommandGroupTest >> testRegisterInsteadOf [
context: [ 1 ];
yourself.

self deny: (group hasCommand: command).
self assert: group entries second equals: subGroup1.

group register: command insteadOf: subGroup1.
@@ -127,12 +127,14 @@ CmCommandGroup >> register: aCommandOrGroup [

{ #category : #'public-api' }
CmCommandGroup >> register: aCommandOrGroup after: anotherCommandOrGroup [
self shouldBeImplemented; flag: #TODO
self ensureNotDuplicated: aCommandOrGroup.
self entries add: aCommandOrGroup after: anotherCommandOrGroup
]

{ #category : #'public-api' }
CmCommandGroup >> register: aCommandOrGroup before: anotherCommandOrGroup [
self shouldBeImplemented; flag: #TODO
self ensureNotDuplicated: aCommandOrGroup.
self entries add: aCommandOrGroup before: anotherCommandOrGroup
]

{ #category : #'public-api' }

0 comments on commit ad5041c

Please sign in to comment.
You can’t perform that action at this time.