Skip to content

Commit

Permalink
Merge pull request #148 from moosetechnology/remove-PUComment
Browse files Browse the repository at this point in the history
Removed PUComment
  • Loading branch information
NicolasAnquetil committed Jun 20, 2024
2 parents ac9d3d6 + 50e1e94 commit e0d81e4
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 222 deletions.
72 changes: 36 additions & 36 deletions src/EsopeImporter-Tests/IASTToFamixVisitorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ IASTToFamixVisitorTest >> testComment [

| entity comment |

programFile progUnits: { IASTMainProgram new
programFile body: { IASTMainProgram new
entityName: 'main';
body: { IASTComment new
text: 'a normal comment';
Expand Down Expand Up @@ -229,7 +229,7 @@ c@_ end segment
(#abs -> #real).
(#ord -> #real) }.

programFile progUnits: { (IASTIncludedFile new
programFile body: { (IASTIncludedFile new
entityName: '_$aFile_inc';
sourceAnchor: self defaultAnchor;
body: {
Expand Down Expand Up @@ -397,7 +397,7 @@ IASTToFamixVisitorTest >> testFamixEsopeCommandSegini [
| famixSegini iastSegini progFile |
iastSegini := self defaultSegmentComand: 'segini' on: 'ptr'.

programFile progUnits: { IASTSubroutine new
programFile body: { IASTSubroutine new
entityName: 'sub';
body: { iastSegini };
yourself }.
Expand Down Expand Up @@ -454,7 +454,7 @@ IASTToFamixVisitorTest >> testFamixEsopeSegment [
(#status -> #logical).
(#age -> #integer) }.

programFile progUnits: { IASTSubroutine new
programFile body: { IASTSubroutine new
entityName: 'sub';
body: { segment };
yourself }.
Expand Down Expand Up @@ -499,7 +499,7 @@ c ptr.attr(/1)
self flag: #TODO.
s__ := self defaultVarEsoSl: #( #ptr #attr ).

programFile progUnits: { (IASTSubroutine new
programFile body: { (IASTSubroutine new
entityName: 'sub';
body: { s__ };
yourself) }.
Expand Down Expand Up @@ -535,7 +535,7 @@ c ptr.attr(/1)
IASTToFamixVisitorTest >> testFamixFortran77 [

| entity |
programFile progUnits: { IASTSubroutine new
programFile body: { IASTSubroutine new
entityName: 'sub';
body: #();
yourself
Expand All @@ -556,6 +556,25 @@ IASTToFamixVisitorTest >> testFamixFortran77 [

]

{ #category : #'tests-fortran' }
IASTToFamixVisitorTest >> testFamixFortran77Comment [
| entity |
programFile body: { IASTComment new
text: ' a comment' ;
isProgUnit: true ;
yourself
}.

entity := programFile accept: visitor.

self assert: entity programUnits size equals: 0.
self assert: entity comments size equals: 1.

entity := entity comments first.
self assert: entity class equals: FamixF77Comment.
self assert: entity content equals: ' a comment'.
]

{ #category : #'tests-esope' }
IASTToFamixVisitorTest >> testFamixFortran77ESOAtWithArrayArgument [
"Special case of a D__ function call with an array as argument
Expand Down Expand Up @@ -587,7 +606,7 @@ IASTToFamixVisitorTest >> testFamixFortran77Invocation [
entityName: 'main';
body: { IASTInvocation new entityName: 'sub'; yourself };
yourself.
programFile progUnits: { callee . caller }.
programFile body: { callee . caller }.

programFile accept: visitor.
entity := visitor model detect: [:each | each class = FamixF77ProgramFile ].
Expand All @@ -607,7 +626,7 @@ IASTToFamixVisitorTest >> testFamixFortran77Invocation [
IASTToFamixVisitorTest >> testFamixFortran77LocalVariable [

| entity var |
programFile progUnits: { IASTSubroutine new
programFile body: { IASTSubroutine new
entityName: 'sub';
body: { (self defaultVariable: 'aVar' withType: 'integer') };
yourself }.
Expand All @@ -632,7 +651,7 @@ IASTToFamixVisitorTest >> testFamixFortran77LocalVariable [
IASTToFamixVisitorTest >> testFamixFortran77PUBlockdata [

| entity |
programFile progUnits: { IASTBlockData new
programFile body: { IASTBlockData new
entityName: 'bdata';
yourself
}.
Expand All @@ -647,30 +666,11 @@ IASTToFamixVisitorTest >> testFamixFortran77PUBlockdata [
self assert: entity programFile isNotNil.
]

{ #category : #'tests-fortran' }
IASTToFamixVisitorTest >> testFamixFortran77PUComment [
| entity |
programFile progUnits: { IASTComment new
text: ' a comment' ;
isProgUnit: true ;
yourself
}.

entity := programFile accept: visitor.

self assert: entity programUnits size equals: 1.

entity := entity programUnits first.
self assert: entity class equals: FamixF77PUComment.
self assert: entity content equals: ' a comment'.
self assert: entity programFile isNotNil.
]

{ #category : #'tests-fortran' }
IASTToFamixVisitorTest >> testFamixFortran77PUFunction [

| entity |
programFile progUnits: { IASTFunction new
programFile body: { IASTFunction new
entityName: 'fct';
yourself }.

Expand All @@ -688,7 +688,7 @@ IASTToFamixVisitorTest >> testFamixFortran77PUFunction [
IASTToFamixVisitorTest >> testFamixFortran77PUFunctionWithParameter [

| entity param |
programFile progUnits: { IASTFunction new
programFile body: { IASTFunction new
entityName: 'fct';
parameters: { self defaultParameter };
yourself }.
Expand All @@ -713,7 +713,7 @@ IASTToFamixVisitorTest >> testFamixFortran77PUFunctionWithParameter [
IASTToFamixVisitorTest >> testFamixFortran77PUMain [

| entity |
programFile progUnits: { IASTMainProgram new
programFile body: { IASTMainProgram new
entityName: 'main';
yourself }.

Expand Down Expand Up @@ -760,7 +760,7 @@ IASTToFamixVisitorTest >> testFamixFortran77SourceAnchor [
IASTToFamixVisitorTest >> testFamixFortran77Subroutine [

| entity |
programFile progUnits: { IASTSubroutine new
programFile body: { IASTSubroutine new
entityName: 'sub';
yourself }.

Expand All @@ -779,7 +779,7 @@ IASTToFamixVisitorTest >> testFamixFortran77Subroutine [
IASTToFamixVisitorTest >> testImplicitWithRange [

| entity sub |
programFile progUnits: { (IASTSubroutine new
programFile body: { (IASTSubroutine new
entityName: 'sub';
body: { IASTImplicit new
rules: { (self implicitRule: 'character' range: { #( $c $f ) }) }
Expand Down Expand Up @@ -819,7 +819,7 @@ c@_#include ""point.seg""
includeCommand: '#include';
entityName: 'point.seg';
yourself.
programFile progUnits: { (IASTSubroutine new
programFile body: { (IASTSubroutine new
entityName: 'test';
body: { includeStmt };
yourself) }.
Expand All @@ -843,7 +843,7 @@ c@_#include ""point.seg""
IASTToFamixVisitorTest >> testMultipleImplicit [

| entity sub |
programFile progUnits: { (IASTSubroutine new
programFile body: { (IASTSubroutine new
entityName: 'sub';
body: { IASTImplicit new
rules: { (self implicitRule: 'character' range: #( #( $c ) #( $d $f ) )) }
Expand Down Expand Up @@ -877,7 +877,7 @@ IASTToFamixVisitorTest >> testMultipleImplicit [
IASTToFamixVisitorTest >> testSimpleImplicit [

| entity sub |
programFile progUnits: { (IASTSubroutine new
programFile body: { (IASTSubroutine new
entityName: 'sub';
body: { IASTImplicit new
rules: { (self implicitRule: 'character' range: { #( $c ) }) }
Expand Down
Loading

0 comments on commit e0d81e4

Please sign in to comment.