Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 - added case for empty detect
  • Loading branch information
guillep committed Aug 10, 2018
1 parent ec3f43c commit 3432004
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tests
testDetectFoundElement

| selected |
selected := (IceNode value: 2) detect: [ :e | e value even ].

self assert: selected equals: 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tests
testDetectNotFoundElement
self should: [ (IceNode value: 1) detect: [ :e | e value even ] ] raise: NotFound
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ firstNodeSuchThat: conditionBlock ifNone: noneBlock
ifFound: [ :found | ^ found ].

^ self parent
nextChildNodeStartingFrom: self
suchThat: conditionBlock
ifNone: noneBlock
ifNil: noneBlock
ifNotNil: [
self parent
nextChildNodeStartingFrom: self
suchThat: conditionBlock
ifNone: noneBlock ]

0 comments on commit 3432004

Please sign in to comment.