Skip to content

Commit

Permalink
Updated scodeinst tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Jun 19, 2017
1 parent 225b295 commit c5c6f9a
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/ExtendSelf1.mo
@@ -0,0 +1,21 @@
// name: ExtendSelf1.mo
// keywords:
// status: correct
// cflags: -d=newInst
//
// Checks that a class can extend a local class via itself.
//

model ExtendSelf1
encapsulated model A
Real x = 1;
end A;

extends ExtendSelf1.A;
end ExtendSelf1;

// Result:
// class ExtendSelf1
// Real x = 1;
// end ExtendSelf1;
// endResult
25 changes: 25 additions & 0 deletions flattening/modelica/scodeinst/ExtendSelf2.mo
@@ -0,0 +1,25 @@
// name: ExtendSelf2.mo
// keywords:
// status: incorrect
// cflags: -d=newInst
//
// Checks that an extends loop gives an error.
//

model A
extends ExtendSelf2;
end A;

model ExtendSelf2
extends A;
end ExtendSelf2;

// Result:
// Error processing file: ExtendSelf2.mo
// [flattening/modelica/scodeinst/ExtendSelf2.mo:10:3-10:22:writable] Error: extends ExtendSelf2 causes an instantiation loop.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/ExtendSelf3.mo
@@ -0,0 +1,21 @@
// name: ExtendSelf3.mo
// keywords:
// status: incorrect
// cflags: -d=newInst
//
// Checks that a class extending from itself gives an error.
//

model ExtendSelf3
extends ExtendSelf3;
end ExtendSelf3;

// Result:
// Error processing file: ExtendSelf3.mo
// [flattening/modelica/scodeinst/ExtendSelf3.mo:10:3-10:22:writable] Error: extends ExtendSelf3 causes an instantiation loop.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
3 changes: 3 additions & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -61,6 +61,9 @@ Extends3.mo \
extends3.mo \
ExtendImport1.mo \
ExtendSections.mo \
ExtendSelf1.mo \
ExtendSelf2.mo \
ExtendSelf3.mo \
ForEquation1.mo \
ForEquation2.mo \
ForEquation3.mo \
Expand Down

0 comments on commit c5c6f9a

Please sign in to comment.