forked from pharo-project/pharo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing the issue pharo-project#7165 for Calypso and Rubric.
Adding tests.
- Loading branch information
Showing
4 changed files
with
121 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
Class { | ||
#name : #RBErrorNodeParserTest, | ||
#superclass : #RBParserTest, | ||
#category : #'AST-Core-Tests-Parser' | ||
} | ||
|
||
{ #category : #tests } | ||
RBErrorNodeParserTest >> testFaultyBinaryMessageSendArgumentShouldHaveTheCorrectMessage [ | ||
|
||
| node | | ||
node := self parserClass parseFaultyExpression: '+ arg'. | ||
|
||
self assert: node isMessage. | ||
self assert: node receiver isParseError. | ||
self assert: node selector equals: #+. | ||
self assert: node arguments first isVariable. | ||
self assert: node arguments first name equals: #arg. | ||
|
||
] | ||
|
||
{ #category : #tests } | ||
RBErrorNodeParserTest >> testFaultyBinaryMessageSendWithLiteralArgumentShouldHaveTheCorrectMessage [ | ||
|
||
| node | | ||
node := self parserClass parseFaultyExpression: '+ 12'. | ||
|
||
self assert: node isMessage. | ||
self assert: node receiver isParseError. | ||
self assert: node selector equals: #+. | ||
self assert: node arguments first isLiteralNode. | ||
self assert: node arguments first value equals: 12. | ||
|
||
] | ||
|
||
{ #category : #tests } | ||
RBErrorNodeParserTest >> testFaultyMessageSendShouldHaveTheCorrectMessage [ | ||
|
||
| node | | ||
node := self parserClass parseFaultyExpression: 'msg: arg'. | ||
|
||
self assert: node isMessage. | ||
self assert: node receiver isParseError. | ||
self assert: node selector equals: #msg:. | ||
self assert: node arguments first isVariable. | ||
self assert: node arguments first name equals: #arg. | ||
|
||
] | ||
|
||
{ #category : #tests } | ||
RBErrorNodeParserTest >> testFaultyMessageSendWithLiteralArgumentShouldHaveTheCorrectMessage [ | ||
|
||
| node | | ||
node := self parserClass parseFaultyExpression: 'msg: 12'. | ||
|
||
self assert: node isMessage. | ||
self assert: node receiver isParseError. | ||
self assert: node selector equals: #msg:. | ||
self assert: node arguments first isLiteralNode. | ||
self assert: node arguments first value equals: 12. | ||
|
||
] | ||
|
||
{ #category : #tests } | ||
RBErrorNodeParserTest >> testFaultyMessageSendWithSymbolsArgumentShouldHaveTheCorrectMessage [ | ||
|
||
| node | | ||
node := self parserClass parseFaultyExpression: 'msg: #lala: and:12'. | ||
|
||
self assert: node isMessage. | ||
self assert: node receiver isParseError. | ||
self assert: node selector equals: #msg:and:. | ||
|
||
self assert: node arguments first isLiteralNode. | ||
self assert: node arguments first value equals: #lala:. | ||
|
||
self assert: node arguments second isLiteralNode. | ||
self assert: node arguments second value equals: 12. | ||
|
||
] | ||
|
||
{ #category : #tests } | ||
RBErrorNodeParserTest >> testFaultyMethodHasAnErrorNodeAndContinueParsing [ | ||
|
||
| node | | ||
node := self parserClass parseFaultyMethod: '1 between: 2 and: 3'. | ||
|
||
self assert: node isMethod. | ||
self assert: node selector equals: #faulty. | ||
|
||
self assert: node body statements first isParseError. | ||
|
||
self assert: node body statements second isMessage. | ||
self assert: node body statements second selector equals: #between:and:. | ||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters