Skip to content

Commit f7f9661

Browse files
committed
Variables should have a name in the model + refactore a little the tests
I plan to add tests on the future local resolver and this will help
1 parent 4d11be4 commit f7f9661

5 files changed

Lines changed: 93 additions & 17 deletions

File tree

src/FAST-Python-Model/FASTPyModel.class.st

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,11 @@ FASTPyModel >> allModules [
3939

4040
^ self allWithType: FASTPyModule
4141
]
42+
43+
{ #category : 'accessing' }
44+
FASTPyModel >> module [
45+
"In general a fast python model can only get one module so I return this module."
46+
47+
self assert: self allModules size = 1.
48+
^ self allModules anyOne
49+
]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Class {
2+
#name : 'FASTPythonAbstractTestCase',
3+
#superclass : 'TestCase',
4+
#category : 'FAST-Python-Tools-Tests',
5+
#package : 'FAST-Python-Tools-Tests'
6+
}
7+
8+
{ #category : 'running' }
9+
FASTPythonAbstractTestCase >> parse: aString [
10+
11+
^ FASTPythonImporter new
12+
errorReportBlock: [ :i | i errors ifNotEmpty: [ self fail: 'Errors happened during parsing. Errors: ' , i errors printString ] ];
13+
parse: aString withPlatformLineEndings
14+
]

src/FAST-Python-Tools-Tests/FASTPythonCFGTest.class.st

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Class {
22
#name : 'FASTPythonCFGTest',
3-
#superclass : 'TestCase',
3+
#superclass : 'FASTPythonAbstractTestCase',
44
#instVars : [
55
'startBlock'
66
],
@@ -14,14 +14,6 @@ FASTPythonCFGTest >> buildCFGForFunction: aString [
1414
startBlock := FASTPythonCFGVisitor buildCFGOf: (self parse: aString) allFunctionDefinitions first
1515
]
1616

17-
{ #category : 'running' }
18-
FASTPythonCFGTest >> parse: aString [
19-
20-
^ FASTPythonImporter new
21-
errorReportBlock: [ :i | i errors ifNotEmpty: [ self fail: 'Errors happened during parsing. Errors: ' , i errors printString ] ];
22-
parse: aString withPlatformLineEndings
23-
]
24-
2517
{ #category : 'tests' }
2618
FASTPythonCFGTest >> testCFGOfClass [
2719

0 commit comments

Comments
 (0)