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

Exception handling tests rewritten for GS64 compatibility #84

Merged
merged 6 commits into from
Aug 7, 2023
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
6 changes: 5 additions & 1 deletion rowan/components/Deployment.ston
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ RwSimpleProjectLoadComponentV2 {
'Buoy-Collections-GS64-Extensions',
'Buoy-Conditions-Extensions',
'Buoy-Conditions',
'Buoy-Exception-Handling-Extensions',
'Buoy-Metaprogramming-Extensions',
'Buoy-Metaprogramming-GS64-Extensions'
],
Expand All @@ -20,10 +21,13 @@ RwSimpleProjectLoadComponentV2 {
},
'Buoy-Collections-GS64-Extensions' : {
'symbolDictName' : 'Globals'
},
},
ytsejam78 marked this conversation as resolved.
Show resolved Hide resolved
'Buoy-Conditions-Extensions' : {
'symbolDictName' : 'Globals'
},
'Buoy-Exception-Handling-Extensions' : {
'symbolDictName' : 'Globals'
},
'Buoy-Metaprogramming-Extensions' : {
'symbolDictName' : 'Globals'
},
Expand Down
1 change: 1 addition & 0 deletions rowan/components/Tests.ston
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RwSimpleProjectLoadComponentV2 {
#packageNames : [
'Buoy-Assertions-Tests',
'Buoy-Conditions-Tests',
'Buoy-Exception-Handling-Extensions-Tests',
'Buoy-SUnit-Tests'
],
#comment : ''
Expand Down
8 changes: 4 additions & 4 deletions source/BaselineOfBuoy/BaselineOfBuoy.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ BaselineOfBuoy >> baselineDynamicBinding: spec [
BaselineOfBuoy >> baselineExceptionHandling: spec [

spec
package: 'Buoy-Exception-Handling';
group: 'Deployment' with: 'Buoy-Exception-Handling';
package: 'Buoy-Exception-Handling-Tests' with: [ spec requires: 'Buoy-Exception-Handling' ];
group: 'Tests' with: 'Buoy-Exception-Handling-Tests'
package: 'Buoy-Exception-Handling-Extensions';
group: 'Deployment' with: 'Buoy-Exception-Handling-Extensions';
package: 'Buoy-Exception-Handling-Extensions-Tests' with: [ spec requires: 'Buoy-Exception-Handling-Extensions' ];
group: 'Tests' with: 'Buoy-Exception-Handling-Extensions-Tests'
]

{ #category : #baselines }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ I'm a test case for the exception handling system.
Class {
#name : #ExceptionHandlingSystemTest,
#superclass : #TestCase,
#category : #'Buoy-Exception-Handling-Tests'
#category : #'Buoy-Exception-Handling-Extensions-Tests'
}

{ #category : #private }
Expand Down Expand Up @@ -32,25 +32,27 @@ ExceptionHandlingSystemTest >> handleZeroDivideAndReturnWithCaret [
{ #category : #'tests - exception sets' }
ExceptionHandlingSystemTest >> testCatchingSetsOfExceptions [

| result |

result := [ ZeroDivide signal + Warning signal ]
on: Warning , ZeroDivide
do: [ :ex | ex resume: 1 ].

self assert: result equals: 2
self assert: ([
Warning signal.
false ]
on: Warning , ZeroDivide
do: [ :ex | ex return: true ]).

self assert: ([
ZeroDivide signal.
false ]
on: Warning , ZeroDivide
do: [ :ex | ex return: true ])
]

{ #category : #'tests - exception sets' }
ExceptionHandlingSystemTest >> testCatchingSetsOfExceptionsWithHierarchy [

| result |

result := [ ZeroDivide signal + Warning signal ]
on: Notification , Error
do: [ :ex | ex resume: 1 ].

self assert: result equals: 2
self assert: ([
Warning signal.
false ]
on: Notification , Error
do: [ :ex | ex return: true ])
]

{ #category : #'tests - ensure' }
Expand Down Expand Up @@ -85,19 +87,13 @@ ExceptionHandlingSystemTest >> testEnsureSemanticsWhenNoException [
{ #category : #'tests - exception sets' }
ExceptionHandlingSystemTest >> testExceptionSetsConcatenation [

| result |

result := [ ZeroDivide signal + Warning signal ]
on: Warning , ZeroDivide , ( MessageNotUnderstood , Error )
do: [ :ex | ex resume: 1 ].

self assert: result equals: 2.

result := [ ZeroDivide signal + Warning signal ]
on: MessageNotUnderstood , Error , ( Warning , ZeroDivide )
do: [ :ex | ex resume: 1 ].
self assert: ([ ZeroDivide signal ]
on: Warning , ZeroDivide , (MessageNotUnderstood , Error)
do: [ :ex | ex return: true ]).

self assert: result equals: 2
self assert: ([ Object new perform: #asdf ]
on: MessageNotUnderstood , Error , (Warning , ZeroDivide)
do: [ :ex | ex return: true ])
]

{ #category : #'tests - exception sets' }
Expand Down
1 change: 1 addition & 0 deletions source/Buoy-Exception-Handling-Extensions-Tests/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'Buoy-Exception-Handling-Extensions-Tests' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Extension { #name : #BlockClosure }

{ #category : #'*Buoy-Exception-Handling-Extensions' }
BlockClosure >> on: selector except: exclusionSelector do: action [

^ self
on: selector
do: [ :exception |
(exclusionSelector handles: exception)
ifTrue: [ exception pass ]
ifFalse: [ action value: exception ] ]
]
1 change: 1 addition & 0 deletions source/Buoy-Exception-Handling-Extensions/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'Buoy-Exception-Handling-Extensions' }
1 change: 0 additions & 1 deletion source/Buoy-Exception-Handling-Tests/package.st

This file was deleted.

9 changes: 0 additions & 9 deletions source/Buoy-Exception-Handling/BlockClosure.extension.st

This file was deleted.

1 change: 0 additions & 1 deletion source/Buoy-Exception-Handling/package.st

This file was deleted.

Loading