Skip to content

Commit 8cd5c70

Browse files
committed
adding support for blocks in pipeTo: .
Author: mica-yl <7644696+mica-yl@users.noreply.github.com>
1 parent 706124f commit 8cd5c70

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

PharoFunctional-Tests/FunctionalTest.class.st

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ FunctionalTest >> testCycle [
5656

5757
{ #category : #tests }
5858
FunctionalTest >> testPipeTo [
59-
self assert: (1 +> [ :x | x+1] ) equals: 2.
60-
self assert: ({1. 2.} +> [ :a| a sum ] ) equals: 3.
59+
|inc|.
60+
inc:=[ :x | x+1].
61+
self assert: (1 +> inc ) equals: 2.
62+
self assert: ([1] +> inc +> inc ) equals: 3.
63+
self assert: ([2*2-2] +> inc +> inc ) equals: 4.
64+
self assert: ({3. 2.} +> [ :a| a sum ] ) equals: 5.
6165
]
6266

6367
{ #category : #tests }

PharoFunctional/Object.extension.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ Object >> nilOr: aBlock [
4747
Object >> pipeTo: aBlock [
4848
"pipe : pass value to function ."
4949
"see : +>"
50-
^ aBlock value: self.
50+
^ aBlock value: self value.
5151
]

0 commit comments

Comments
 (0)