@@ -1006,6 +1006,63 @@ FASTPythonImporterTest >> testGlobalStatement [
10061006
10071007]
10081008
1009+ { #category : ' tests - if' }
1010+ FASTPythonImporterTest >> testIf [
1011+ " Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol: "
1012+
1013+ self parse: ' if x > 0:
1014+ 3' .
1015+
1016+ self assert: (fast allWithType: FASTPyModule ) size equals: 1 .
1017+ self assert: (fast allWithType: FASTPyBlock ) size equals: 1 .
1018+ self assert: (fast allWithType: FASTPyIfStatement ) size equals: 1 .
1019+ self assert: (fast allWithType: FASTPyIdentifier ) size equals: 1 .
1020+ self assert: (fast allWithType: FASTPyComparisonOperator ) size equals: 1 .
1021+ self assert: (fast allWithType: FASTPyInteger ) size equals: 2 .
1022+
1023+ stack push: fast rootEntities anyOne genericChildren first.
1024+ self assert: self topEntity sourceCode equals: ' if x > 0:
1025+ 3' withPlatformLineEndings.
1026+ self assert: (self topEntity isOfType: FASTPyIfStatement ).
1027+
1028+ " Testing value of monovalue relation condition"
1029+ self assert: self topEntity condition isNotNil.
1030+
1031+ stack push: self topEntity condition.
1032+ self assert: self topEntity sourceCode equals: ' x > 0' .
1033+ self assert: (self topEntity isOfType: FASTPyComparisonOperator ).
1034+
1035+ " Testing value of multivalued relation operands"
1036+ self assert: self topEntity operands size equals: 2 .
1037+
1038+ stack push: (stack top operands at: 1 ).
1039+ self assert: self topEntity sourceCode equals: ' x' .
1040+ self assert: (self topEntity isOfType: FASTPyIdentifier ).
1041+ stack pop.
1042+
1043+ stack push: (stack top operands at: 2 ).
1044+ self assert: self topEntity sourceCode equals: ' 0' .
1045+ self assert: (self topEntity isOfType: FASTPyInteger ).
1046+ stack pop.
1047+ self assert: self topEntity operators equals: #('>') .
1048+ stack pop.
1049+
1050+ " Testing value of monovalue relation thenBlock"
1051+ self assert: self topEntity thenBlock isNotNil.
1052+
1053+ stack push: self topEntity thenBlock.
1054+ self assert: self topEntity sourceCode equals: ' 3' .
1055+ self assert: (self topEntity isOfType: FASTPyBlock ).
1056+
1057+ " Testing value of multivalued relation statements"
1058+ self assert: self topEntity statements size equals: 1 .
1059+
1060+ stack push: (stack top statements at: 1 ).
1061+ self assert: self topEntity sourceCode equals: ' 3' .
1062+ self assert: (self topEntity isOfType: FASTPyInteger ).
1063+
1064+ ]
1065+
10091066{ #category : ' tests - imports' }
10101067FASTPythonImporterTest >> testImport [
10111068 " Generated as regression test by FASTPythonImporterTest class>>#generateTestNamed:fromCode: "
0 commit comments