Skip to content

Commit

Permalink
core: fix tests by catching unhandled UndeclaredVariableWarnings
Browse files Browse the repository at this point in the history
This is necessary to complement SUnit-ct.130, which treats unhandled warnings as a failure of the test case. Note that there are still some other things to do at the moment:

* This particular exception is weird at all - a warning should not "do nothing" in its defaultAction, so maybe the superclass of this exception should be changed instead
* smalltalkCI has not yet been told about the new semantics of warnings in tests (I'm on it).

Given these points, I'm parking this patch here for now until the above points have been resolved ...
  • Loading branch information
LinqLover committed Jan 19, 2022
1 parent 2d97910 commit 4a0c878
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 73 deletions.
72 changes: 36 additions & 36 deletions packages/Sandblocks-Core/SBASTNodeTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Class {
#category : #'Sandblocks-Core-Tests'
}

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testBindingRename [

| block editor |
block := '[|from to| from squared. from squared]' parseAsSandblock.
block := self parse: '[|from to| from squared. from squared]'.
editor := self methodFor: block.

editor startInput: block statements last receiver at: 1 replacingContents: true.
Expand All @@ -19,11 +19,11 @@ SBASTNodeTest >> testBindingRename [
self assert: 'to' equals: block statements last receiver contents
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testCanClearMessagePart [

| block selection editor |
block := '[a + 5]' parseAsSandblock.
block := self parse: '[a + 5]'.
selection := block statements first messageParts first.
editor := (self methodFor: block) select: selection.
editor startInput: selection at: 1 replacingContents: true.
Expand All @@ -32,11 +32,11 @@ SBASTNodeTest >> testCanClearMessagePart [
self assert: selection parentSandblock isMessageSend
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testCanUndoAppendLine [

| block selection editor |
block := '[5]' parseAsSandblock.
block := self parse: '[5]'.
editor := self methodFor: block.
selection := block statements first.
selection performAction: #insertStatementBelow.
Expand All @@ -50,11 +50,11 @@ SBASTNodeTest >> testCanUndoAppendLine [
self assert: 1 equals: block statements size
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testChangeSendToAssignment [

| block selection editor |
block := '[a + 5]' parseAsSandblock.
block := self parse: '[a + 5]'.
selection := block statements first messageParts first.
editor := (self methodFor: block) select: selection.
editor startInput: selection at: 1 replacingContents: true.
Expand All @@ -64,11 +64,11 @@ SBASTNodeTest >> testChangeSendToAssignment [
self assert: block statements first isMessageSend not
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testInsertStatementAboveOrBelow [

| block selection |
block := '[5]' parseAsSandblock.
block := self parse: '[5]'.
selection := block statements first.
self methodFor: block.
selection performAction: #insertStatementBelow.
Expand All @@ -77,22 +77,22 @@ SBASTNodeTest >> testInsertStatementAboveOrBelow [
self assert: block statements first isUnknown
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testMergeMessages [

| block editor |
block := '[self assert: (5 equals: 3)]' parseAsSandblock.
block := self parse: '[self assert: (5 equals: 3)]'.
editor := self methodFor: block.

block statements first arguments first performAction: #unwrapList.
self assert: #assert:equals: equals: block statements first selector
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testUndoChangeSendToAssignment [

| block selection editor |
block := '[a + 5]' parseAsSandblock.
block := self parse: '[a + 5]'.
selection := block statements first messageParts first.
editor := (self methodFor: block) select: selection.
editor startInput: selection at: 1 replacingContents: true.
Expand All @@ -105,11 +105,11 @@ SBASTNodeTest >> testUndoChangeSendToAssignment [
self assert: block statements first isMessageSend not
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testUndoWrapInArray [

| block selection editor |
block := '[self squared. self changeTableLayout. self resize]' parseAsSandblock.
block := self parse: '[self squared. self changeTableLayout. self resize]'.
selection := block statements first.
editor := self methodFor: block.
editor select: selection.
Expand All @@ -128,11 +128,11 @@ SBASTNodeTest >> testUndoWrapInArray [
self assert: block statements third receiver contents = 'self'
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testUndoWrapInBlock [

| block selection editor |
block := '[self squared. self changeTableLayout. self resize]' parseAsSandblock.
block := self parse: '[self squared. self changeTableLayout. self resize]'.
selection := block statements first.
editor := self methodFor: block.
editor select: selection.
Expand All @@ -151,11 +151,11 @@ SBASTNodeTest >> testUndoWrapInBlock [
self assert: block statements third receiver contents = 'self'
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testUndoWrapInCascade [

| block selection editor |
block := '[self squared. self changeTableLayout. self resize]' parseAsSandblock.
block := self parse: '[self squared. self changeTableLayout. self resize]'.
selection := block statements first.
editor := self methodFor: block.
editor startOrAddToMultiSelection: block statements first.
Expand All @@ -172,11 +172,11 @@ SBASTNodeTest >> testUndoWrapInCascade [
self assert: block statements third receiver contents = 'self'
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testWrapAsArgument [

| block selection |
block := '[5]' parseAsSandblock.
block := self parse: '[5]'.
self methodFor: block.
selection := block statements first.
selection performAction: #wrapAsArgument.
Expand All @@ -185,47 +185,47 @@ SBASTNodeTest >> testWrapAsArgument [
self assert: block statements first receiver isUnknown
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testWrapInArrayType [

| block selection |
block := '[5]' parseAsSandblock.
block := self parse: '[5]'.
selection := block statements first.
(self methodFor: block) select: selection.
selection performAction: #wrapInDynamicArray.
self assert: block statements first isArrayBlock.
self assert: block statements first firstSubmorph = selection
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testWrapInBlock [

| block selection |
block := '[5]' parseAsSandblock.
block := self parse: '[5]'.
selection := block statements first.
(self methodFor: block) select: selection.
selection performAction: #wrapInBlock.
self assert: block statements first isBlockBody.
self assert: block statements first statements first = selection
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testWrapInCascade [

| block selection |
block := '[5 squared]' parseAsSandblock.
block := self parse: '[5 squared]'.
selection := block statements first.
(self methodFor: block) select: selection.
selection wrapInCascade.
self assert: block statements first isCascade.
self assert: block statements first messages first = selection
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testWrapInCascadeMessageParts [

| block selection editor |
block := '[5 yourself. 5 parse: 2]' parseAsSandblock.
block := self parse: '[5 yourself. 5 parse: 2]'.
selection := block statements first.
editor := self methodFor: block.
editor select: selection.
Expand All @@ -238,11 +238,11 @@ SBASTNodeTest >> testWrapInCascadeMessageParts [
self assert: block statements first messages second receiver isNil
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testWrapInCascadeMultiSelection [

| block selection editor |
block := '[5 squared. 5 + 2]' parseAsSandblock.
block := self parse: '[5 squared. 5 + 2]'.
selection := block statements first.
editor := self methodFor: block.
editor select: selection.
Expand All @@ -255,11 +255,11 @@ SBASTNodeTest >> testWrapInCascadeMultiSelection [
self assert: block statements first messages second receiver isNil
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testWrapInMessageSend [

| block selection |
block := '[5]' parseAsSandblock.
block := self parse: '[5]'.
selection := block statements first.
self methodFor: block.
selection grammarHandler
Expand All @@ -270,11 +270,11 @@ SBASTNodeTest >> testWrapInMessageSend [
self assert: block statements first receiver = selection
]

{ #category : #'as yet unclassified' }
{ #category : #tests }
SBASTNodeTest >> testWrapInReturn [

| block selection |
block := '[5]' parseAsSandblock.
block := self parse: '[5]'.
self methodFor: block.
selection := block statements first.
selection performAction: #wrapInReturn.
Expand Down
8 changes: 4 additions & 4 deletions packages/Sandblocks-Core/SBBlockTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Class {
SBBlockTest >> testLeftRotateBinaryMessages [

| block selection editor |
block := '[(a + b) * c]' parseAsSandblock.
block := self parse: '[(a + b) * c]'.
editor := self methodFor: block.
selection := block statements first receiver.
selection leftRotate.
Expand All @@ -23,7 +23,7 @@ SBBlockTest >> testLeftRotateBinaryMessages [
SBBlockTest >> testRotateBlock [

| block selection editor |
block := '[a or: [b]]' parseAsSandblock.
block := self parse: '[a or: [b]]'.
editor := self methodFor: block.
selection := block statements first arguments first.
selection leftRotate.
Expand All @@ -38,7 +38,7 @@ SBBlockTest >> testRotateBlock [
SBBlockTest >> testRotateKeywordMessage [

| block selection editor |
block := '[(a or: b) ifTrue: c]' parseAsSandblock.
block := self parse: '[(a or: b) ifTrue: c]'.
editor := self methodFor: block.
selection := block statements first receiver.
selection leftRotate.
Expand All @@ -53,7 +53,7 @@ SBBlockTest >> testRotateKeywordMessage [
SBBlockTest >> testSwap [

| block selection n5 n3 |
block := '[5 squared: 3]' parseAsSandblock.
block := self parse: '[5 squared: 3]'.
self methodFor: block.
selection := block statements first.
n5 := selection receiver.
Expand Down
12 changes: 6 additions & 6 deletions packages/Sandblocks-Core/SBClipboardTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SBClipboardTest >> tearDown [
SBClipboardTest >> testCopyPasteBlock [

| block from to |
block := '[5. 6]' parseAsSandblock.
block := self parse: '[5. 6]'.
self methodFor: block.
from := block statements first.
to := block statements second.
Expand All @@ -41,7 +41,7 @@ SBClipboardTest >> testCopyPasteBlock [
SBClipboardTest >> testCopyString [

| block from |
block := '[5 squared]' parseAsSandblock.
block := self parse: '[5 squared]'.
self methodFor: block.
from := block statements first.

Expand All @@ -55,7 +55,7 @@ SBClipboardTest >> testCopyString [
SBClipboardTest >> testPasteAfter [

| block selection editor |
block := '[a. b. c. self selected: 5]' parseAsSandblock.
block := self parse: '[a. b. c. self selected: 5]'.
selection := block statements last.
editor := self methodFor: block.
block statements first select.
Expand All @@ -71,7 +71,7 @@ SBClipboardTest >> testPasteAfter [
SBClipboardTest >> testPasteMultiple [

| block selection editor |
block := '[a. b. c. self selected: 5]' parseAsSandblock.
block := self parse: '[a. b. c. self selected: 5]'.
selection := block statements last.
editor := self methodFor: block.
block statements first select.
Expand All @@ -89,7 +89,7 @@ SBClipboardTest >> testPasteMultiple [
SBClipboardTest >> testPasteString [

| block from |
block := '[5]' parseAsSandblock.
block := self parse: '[5]'.
self methodFor: block.
from := block statements first.

Expand All @@ -102,7 +102,7 @@ SBClipboardTest >> testPasteString [
SBClipboardTest >> testPasteStringAfterCopyBlock [

| block from to |
block := '[5. 6]' parseAsSandblock.
block := self parse: '[5. 6]'.
self methodFor: block.
from := block statements first.
to := block statements second.
Expand Down
Loading

0 comments on commit 4a0c878

Please sign in to comment.