Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added test to check for nil semantics of uninitialized local variables and empty blocks. #54

Merged
merged 2 commits into from
Aug 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions TestSuite/BasicInterpreterTests/Blocks.som
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,19 @@ Blocks = (
methodLocal := 3.
a + methodLocal] value: 5)
)

testEmptyZeroArg = (
[] value == nil ifTrue: [ ^ 1 ].
^ 2
)

testEmptyOneArg = (
([:x | ] value: 4) == nil ifTrue: [ ^ 1 ].
^ 2
)

testEmptyTwoArg = (
([:x :y | ] value: 4 with: 5) == nil ifTrue: [ ^ 1 ].
^ 2
)
)
2 changes: 1 addition & 1 deletion TestSuite/BasicInterpreterTests/NumberOfTests.som
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ NumberOfTests = (

"Return the known number of tests,
should be used in basic interpreter test harness to confirm completeness"
numberOfTests = ( ^ 52 )
numberOfTests = ( ^ 57 )
)
12 changes: 12 additions & 0 deletions TestSuite/BasicInterpreterTests/Regressions.som
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,16 @@ Regressions = (
'foo:' asSymbol == #foo: ifTrue: [ ^ 1 ].
^ 2
)

testUninitializedLocal = (
| local |
local == nil ifTrue: [ ^ 1 ].
^ 2
)

testUninitializedLocalInBlock = (
[ | local |
local == nil ifTrue: [ ^ 1 ] ] value.
^ 2
)
)