Skip to content

Commit 16cb5d1

Browse files
committed
Finish to handle with statement
1 parent 50f0d61 commit 16cb5d1

1 file changed

Lines changed: 103 additions & 10 deletions

File tree

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

Lines changed: 103 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ FASTPythonImporterTest >> setUp [
162162
stack := Stack new
163163
]
164164

165-
{ #category : 'tests - with statement' }
165+
{ #category : 'tests - with statements' }
166166
FASTPythonImporterTest >> testAsPatternWithAttribute [
167167
<generated>
168168
"Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
@@ -234,7 +234,7 @@ FASTPythonImporterTest >> testAsPatternWithAttribute [
234234
self assert: (self topEntity isOfType: FASTPyPassStatement)
235235
]
236236

237-
{ #category : 'tests - with statement' }
237+
{ #category : 'tests - with statements' }
238238
FASTPythonImporterTest >> testAsPatternWithList [
239239
<generated>
240240
"Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
@@ -310,7 +310,7 @@ FASTPythonImporterTest >> testAsPatternWithList [
310310
self assert: (self topEntity isOfType: FASTPyPassStatement)
311311
]
312312

313-
{ #category : 'tests - with statement' }
313+
{ #category : 'tests - with statements' }
314314
FASTPythonImporterTest >> testAsPatternWithSourceAttributeAccess [
315315
<generated>
316316
"Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
@@ -371,7 +371,7 @@ FASTPythonImporterTest >> testAsPatternWithSourceAttributeAccess [
371371
self assert: (self topEntity isOfType: FASTPyPassStatement)
372372
]
373373

374-
{ #category : 'tests - with statement' }
374+
{ #category : 'tests - with statements' }
375375
FASTPythonImporterTest >> testAsPatternWithSourceCall [
376376
<generated>
377377
"Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
@@ -433,7 +433,7 @@ FASTPythonImporterTest >> testAsPatternWithSourceCall [
433433
self assert: (self topEntity isOfType: FASTPyPassStatement)
434434
]
435435

436-
{ #category : 'tests - with statement' }
436+
{ #category : 'tests - with statements' }
437437
FASTPythonImporterTest >> testAsPatternWithSourceIdentifier [
438438
<generated>
439439
"Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
@@ -484,7 +484,7 @@ FASTPythonImporterTest >> testAsPatternWithSourceIdentifier [
484484
self assert: (self topEntity isOfType: FASTPyPassStatement)
485485
]
486486

487-
{ #category : 'tests - with statement' }
487+
{ #category : 'tests - with statements' }
488488
FASTPythonImporterTest >> testAsPatternWithSourceSubscript [
489489
<generated>
490490
"Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
@@ -552,7 +552,7 @@ FASTPythonImporterTest >> testAsPatternWithSourceSubscript [
552552
self assert: (self topEntity isOfType: FASTPyPassStatement)
553553
]
554554

555-
{ #category : 'tests - with statement' }
555+
{ #category : 'tests - with statements' }
556556
FASTPythonImporterTest >> testAsPatternWithSubscript [
557557
<generated>
558558
"Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
@@ -652,7 +652,7 @@ FASTPythonImporterTest >> testAsPatternWithSubscript [
652652
self assert: (self topEntity isOfType: FASTPyPassStatement)
653653
]
654654

655-
{ #category : 'tests - with statement' }
655+
{ #category : 'tests - with statements' }
656656
FASTPythonImporterTest >> testAsPatternWithTuple [
657657
<generated>
658658
"Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
@@ -51657,7 +51657,7 @@ else: print("Hello")' withPlatformLineEndings.
5165751657
self assert: (self topEntity isOfType: FASTPyIdentifier)
5165851658
]
5165951659

51660-
{ #category : 'tests - with statement' }
51660+
{ #category : 'tests - with statements' }
5166151661
FASTPythonImporterTest >> testWithStatement [
5166251662
<generated>
5166351663
"Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
@@ -51702,7 +51702,7 @@ FASTPythonImporterTest >> testWithStatement [
5170251702
self assert: (self topEntity isOfType: FASTPyPassStatement)
5170351703
]
5170451704

51705-
{ #category : 'tests - with statement' }
51705+
{ #category : 'tests - with statements' }
5170651706
FASTPythonImporterTest >> testWithStatementWithAsPattern [
5170751707
<generated>
5170851708
"Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
@@ -51764,6 +51764,99 @@ FASTPythonImporterTest >> testWithStatementWithAsPattern [
5176451764
self assert: (self topEntity isOfType: FASTPyPassStatement)
5176551765
]
5176651766

51767+
{ #category : 'tests - with statements' }
51768+
FASTPythonImporterTest >> testWithStatementWithMultipleAsPattern [
51769+
<generated>
51770+
"Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
51771+
Regenerate executing: self regenerateTest: #testWithStatementWithMultipleAsPattern "
51772+
51773+
self parse: 'with expr1 as target1, expr2 as target2, expr3 as target3: pass'.
51774+
51775+
self assert: (fast allWithType: FASTPyAsPattern) size equals: 3.
51776+
self assert: (fast allWithType: FASTPyIdentifier) size equals: 6.
51777+
self assert: (fast allWithType: FASTPyModule) size equals: 1.
51778+
self assert: (fast allWithType: FASTPyPassStatement) size equals: 1.
51779+
self assert: (fast allWithType: FASTPyWithStatement) size equals: 1.
51780+
51781+
stack push: fast rootEntities anyOne containedEntities first.
51782+
self assert: self topEntity sourceCode equals: 'with expr1 as target1, expr2 as target2, expr3 as target3: pass'.
51783+
self assert: (self topEntity isOfType: FASTPyWithStatement).
51784+
self assert: (self topEntity isOfType: FASTTStatementBlock).
51785+
51786+
"Testing value of multivalued relation items"
51787+
self assert: self topEntity items size equals: 3.
51788+
51789+
stack push: (stack top items at: 1).
51790+
self assert: self topEntity sourceCode equals: 'expr1 as target1'.
51791+
self assert: (self topEntity isOfType: FASTPyAsPattern).
51792+
51793+
"Testing value of monovalue relation source"
51794+
self assert: self topEntity source isNotNil.
51795+
51796+
stack push: self topEntity source.
51797+
self assert: self topEntity sourceCode equals: 'expr1'.
51798+
self assert: (self topEntity isOfType: FASTPyIdentifier).
51799+
stack pop.
51800+
51801+
"Testing value of monovalue relation target"
51802+
self assert: self topEntity target isNotNil.
51803+
51804+
stack push: self topEntity target.
51805+
self assert: self topEntity sourceCode equals: 'target1'.
51806+
self assert: (self topEntity isOfType: FASTPyIdentifier).
51807+
stack pop.
51808+
stack pop.
51809+
51810+
stack push: (stack top items at: 2).
51811+
self assert: self topEntity sourceCode equals: 'expr2 as target2'.
51812+
self assert: (self topEntity isOfType: FASTPyAsPattern).
51813+
51814+
"Testing value of monovalue relation source"
51815+
self assert: self topEntity source isNotNil.
51816+
51817+
stack push: self topEntity source.
51818+
self assert: self topEntity sourceCode equals: 'expr2'.
51819+
self assert: (self topEntity isOfType: FASTPyIdentifier).
51820+
stack pop.
51821+
51822+
"Testing value of monovalue relation target"
51823+
self assert: self topEntity target isNotNil.
51824+
51825+
stack push: self topEntity target.
51826+
self assert: self topEntity sourceCode equals: 'target2'.
51827+
self assert: (self topEntity isOfType: FASTPyIdentifier).
51828+
stack pop.
51829+
stack pop.
51830+
51831+
stack push: (stack top items at: 3).
51832+
self assert: self topEntity sourceCode equals: 'expr3 as target3'.
51833+
self assert: (self topEntity isOfType: FASTPyAsPattern).
51834+
51835+
"Testing value of monovalue relation source"
51836+
self assert: self topEntity source isNotNil.
51837+
51838+
stack push: self topEntity source.
51839+
self assert: self topEntity sourceCode equals: 'expr3'.
51840+
self assert: (self topEntity isOfType: FASTPyIdentifier).
51841+
stack pop.
51842+
51843+
"Testing value of monovalue relation target"
51844+
self assert: self topEntity target isNotNil.
51845+
51846+
stack push: self topEntity target.
51847+
self assert: self topEntity sourceCode equals: 'target3'.
51848+
self assert: (self topEntity isOfType: FASTPyIdentifier).
51849+
stack pop.
51850+
stack pop.
51851+
51852+
"Testing value of multivalued relation statements"
51853+
self assert: self topEntity statements size equals: 1.
51854+
51855+
stack push: (stack top statements at: 1).
51856+
self assert: self topEntity sourceCode equals: 'pass'.
51857+
self assert: (self topEntity isOfType: FASTPyPassStatement)
51858+
]
51859+
5176751860
{ #category : 'running' }
5176851861
FASTPythonImporterTest >> topEntity [
5176951862

0 commit comments

Comments
 (0)