Skip to content

Commit

Permalink
Add test capturing errors in multimorphic call sites with blocks with…
Browse files Browse the repository at this point in the history
… different count of args
  • Loading branch information
charig committed Jul 27, 2016
1 parent 43d21bb commit 3a7e9af
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions TestSuite/BlockTest.som
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,28 @@ BlockTest = TestCase (
^[^42]
)

blockWithoutArgs = (
^[1]
)

blockWithArg = (
^[:arg | arg. 2]
)


testSimpleBlocks = (
self assert: 42 equals: self simpleBlock value.
self assert: 4 equals: (self incBlock value: 3).
self assert: 43 equals: ((self adderBlock: 13) value: 30).
)

testMultiMorphicBlockSite = (
| blocks |
blocks := Array with: self blockWithoutArgs with: self blockWithArg.
blocks withIndexDo: [:i :block | self assert: block numArgs equals: (i - 1)].
"blocks do: [:block | self assert: block value equals: 1]."
)

testClosure = (
| counter |
counter := self counterBlock.
Expand Down

1 comment on commit 3a7e9af

@smarr
Copy link

@smarr smarr commented on 3a7e9af Jul 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot :)

Please sign in to comment.