Skip to content

Commit

Permalink
Add testcase for #3551
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Nov 10, 2015
1 parent 589568e commit 037163f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions openmodelica/diff/AddDeleteComponent.mos
Expand Up @@ -26,7 +26,11 @@ if s1<>diffModelicaFileListings(contents, s2, OpenModelica.Scripting.DiffFormat.
print("\nStart model:\n\n" + contents + "\n");
print("\ndeleteComponent+listFile:\n\n" + s2 + "\n");
print("\nDiff:\n\n" + diffModelicaFileListings(contents, s2) + "\n");
print("\nDiff from expected:\n\n" + diffModelicaFileListings(s1, s2) + "\n");
print(getErrorString());
writeFile("a",s1);
writeFile("b",s2);
system("diff -u a b");
end if;
print("OK\n");

Expand Down
1 change: 1 addition & 0 deletions openmodelica/diff/Makefile
Expand Up @@ -8,6 +8,7 @@ AddComponent2.mos \
AddDeleteComponent.mos \
ChangeSourceFile.mos \
ListFile.mos \
removeComponentModifiers.mos \
TestDiffListAPI.mos

# test that currently fail. Move up when fixed.
Expand Down
27 changes: 27 additions & 0 deletions openmodelica/diff/removeComponentModifiers.mos
@@ -0,0 +1,27 @@
// status: correct

echo(false);
s1 := "model M1
A a(abc = 23) annotation(Placement(visible = true, transformation(origin={10,30}, extent = {{-30, -30}, {30, 30}}, rotation = 180)));
end M1;";
loadString(s1, "M1.mo");
getErrorString();
removeComponentModifiers(M1, "a");
getErrorString();
answer := "model M1
A a annotation(Placement(visible = true, transformation(origin={10,30}, extent = {{-30, -30}, {30, 30}}, rotation = 180)));
end M1;";
s2 := listFile(M1);
if answer<>diffModelicaFileListings(s1, s2, OpenModelica.Scripting.DiffFormat.plain) then
print("\nFailed \n");
print("\nStart model:\n\n" + s1 + "\n");
print("\nremoveComponentModifiers + listFile:\n\n" + s2 + "\n");
print("\nDiff:\n\n" + diffModelicaFileListings(s1, s2) + "\n");
print(getErrorString());
exit(1);
end if;
print("OK\n");

// Result:
// OK
// endResult

0 comments on commit 037163f

Please sign in to comment.