Skip to content

Commit eb2fca3

Browse files
committed
Manage type parameters of class definitions
1 parent 8d444cb commit eb2fca3

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

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

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8376,6 +8376,74 @@ FASTPythonImporterTest >> testClassDefinitionWithSuperclassSubscript [
83768376
self assert: (self topEntity isOfType: FASTPyIdentifier)
83778377
]
83788378

8379+
{ #category : 'tests - classes' }
8380+
FASTPythonImporterTest >> testClassDefinitionWithTypeParameters [
8381+
<generated>
8382+
"Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
8383+
Regenerate executing: self regenerateTest: #testClassDefinitionWithTypeParameters "
8384+
8385+
self parse: 'class Pair[K, V]: pass'.
8386+
8387+
self assert: (fast allWithType: FASTPyBlock) size equals: 1.
8388+
self assert: (fast allWithType: FASTPyClassDefinition) size equals: 1.
8389+
self assert: (fast allWithType: FASTPyIdentifier) size equals: 2.
8390+
self assert: (fast allWithType: FASTPyModule) size equals: 1.
8391+
self assert: (fast allWithType: FASTPyPassStatement) size equals: 1.
8392+
self assert: (fast allWithType: FASTPyType) size equals: 2.
8393+
8394+
stack push: fast rootEntities anyOne containedEntities first.
8395+
self assert: self topEntity sourceCode equals: 'class Pair[K, V]: pass'.
8396+
self assert: (self topEntity isOfType: FASTPyClassDefinition).
8397+
self assert: (self topEntity isOfType: FASTPyTDefinition).
8398+
self assert: (self topEntity isOfType: FASTTWithParameters).
8399+
self assert: (self topEntity isOfType: FASTTWithStatements).
8400+
self assert: self topEntity name equals: 'Pair'.
8401+
8402+
"Testing value of monovalue relation statementBlock"
8403+
self assert: self topEntity statementBlock isNotNil.
8404+
8405+
stack push: self topEntity statementBlock.
8406+
self assert: self topEntity sourceCode equals: 'pass'.
8407+
self assert: (self topEntity isOfType: FASTPyBlock).
8408+
self assert: (self topEntity isOfType: FASTTStatementBlock).
8409+
8410+
"Testing value of multivalued relation statements"
8411+
self assert: self topEntity statements size equals: 1.
8412+
8413+
stack push: (stack top statements at: 1).
8414+
self assert: self topEntity sourceCode equals: 'pass'.
8415+
self assert: (self topEntity isOfType: FASTPyPassStatement).
8416+
stack pop.
8417+
stack pop.
8418+
8419+
"Testing value of multivalued relation typeParameters"
8420+
self assert: self topEntity typeParameters size equals: 2.
8421+
8422+
stack push: (stack top typeParameters at: 1).
8423+
self assert: self topEntity sourceCode equals: 'K'.
8424+
self assert: (self topEntity isOfType: FASTPyType).
8425+
8426+
"Testing value of monovalue relation content"
8427+
self assert: self topEntity content isNotNil.
8428+
8429+
stack push: self topEntity content.
8430+
self assert: self topEntity sourceCode equals: 'K'.
8431+
self assert: (self topEntity isOfType: FASTPyIdentifier).
8432+
stack pop.
8433+
stack pop.
8434+
8435+
stack push: (stack top typeParameters at: 2).
8436+
self assert: self topEntity sourceCode equals: 'V'.
8437+
self assert: (self topEntity isOfType: FASTPyType).
8438+
8439+
"Testing value of monovalue relation content"
8440+
self assert: self topEntity content isNotNil.
8441+
8442+
stack push: self topEntity content.
8443+
self assert: self topEntity sourceCode equals: 'V'.
8444+
self assert: (self topEntity isOfType: FASTPyIdentifier)
8445+
]
8446+
83798447
{ #category : 'tests - comments' }
83808448
FASTPythonImporterTest >> testComment [
83818449
<generated>

0 commit comments

Comments
 (0)