Skip to content

Commit

Permalink
Added "access on expressions" test.
Browse files Browse the repository at this point in the history
  • Loading branch information
BenediktMagnus committed Feb 29, 2024
1 parent 2695c3f commit c460438
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/endToEnd/runWithOutput/inputs/accessOnExpressions/main.ph
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Standard.Io;
import AccessOnExpressions.MyClass;

module AccessOnExpressions.Main;

function main ()
{
let variable myClass := new MyClass();

let myField := myClass.getField();
Io.writeLine(myField);

Io.writeLine(myClass.getField());

myClass.setField('setField');
Io.writeLine(myClass.getField());

myClass := new MyClass();

let myFieldB := returnClass(myClass).getField();
Io.writeLine(myFieldB);

returnClass(myClass).setField('setField');
Io.writeLine(returnClass(myClass).getField());
}

function returnClass (myClass: MyClass): MyClass
{
return myClass;
}

13 changes: 13 additions & 0 deletions tests/endToEnd/runWithOutput/inputs/accessOnExpressions/myClass.ph
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class AccessOnExpressions.MyClass;

field variable myField: String := 'myField';

method getField (): String
{
return myField;
}

method setField (value: String)
{
myField := value;
}
5 changes: 5 additions & 0 deletions tests/endToEnd/runWithOutput/outputs/accessOnExpressions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
myField
myField
setField
myField
setField

0 comments on commit c460438

Please sign in to comment.