Skip to content

Commit

Permalink
Merge pull request #84 from ba-st/gs64-exception-handling
Browse files Browse the repository at this point in the history
Exception handling tests rewritten for GS64 compatibility
  • Loading branch information
gcotelli authored Aug 7, 2023
2 parents b82be16 + 41e849d commit ea9229e
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 43 deletions.
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'
},
},
'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.

0 comments on commit ea9229e

Please sign in to comment.