Add test for reconcile of stemcells block

This commit is contained in:
Kris De Volder
2017-07-11 10:42:48 -07:00
parent 237ec550e4
commit 011cb5bcb0
2 changed files with 15 additions and 1 deletions

View File

@@ -152,6 +152,18 @@ public class BoshEditorTest {
"- alias<*>"
);
}
@Test public void stemcellReconciling() throws Exception {
Editor editor = harness.newEditor(
"stemcells:\n" +
"- {}"
);
editor.assertProblems(
"-|One of [name, os] is required",
"-|[alias, version] are required",
"}|[director_uuid, instance_groups, name, releases, update] are required"
);
}
@Test public void releasesBlockCompletions() throws Exception {
Editor editor = harness.newEditor(

View File

@@ -86,7 +86,9 @@ public class Editor {
public int compare(Diagnostic o1, Diagnostic o2) {
int diff = compare(o1.getRange().getStart(), o2.getRange().getStart());
if (diff!=0) return diff;
return compare(o1.getRange().getEnd(), o2.getRange().getEnd());
diff = compare(o1.getRange().getEnd(), o2.getRange().getEnd());
if (diff!=0) return diff;
return o1.getMessage().compareTo(o2.getMessage());
}
private int compare(Position p1, Position p2) {