Skip to content

Commit

Permalink
Apply formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
lhstrh committed Sep 30, 2023
1 parent 3b216d8 commit 20e7b3f
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,4 @@ public boolean check(Element e, String name, MessageReporter v) {
public String toString() {
return "a dictionary that maps strings keys to string values";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -1286,42 +1286,74 @@ public void recognizeHostNames() throws Exception {
ArrayType.STRING_ARRAY,
List.of(
List.of("[1 msec]", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING),
List.of("[foo, {bar: baz}]", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING),
List.of("{bar: baz}", LfPackage.eINSTANCE.getKeyValuePair(), ArrayType.STRING_ARRAY)),
List.of(
"[foo, {bar: baz}]", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING),
List.of(
"{bar: baz}", LfPackage.eINSTANCE.getKeyValuePair(), ArrayType.STRING_ARRAY)),
UnionType.STRING_OR_STRING_ARRAY,
List.of(
List.of("[1 msec]", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING),
List.of("[foo, {bar: baz}]", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING),
List.of("{bar: baz}", LfPackage.eINSTANCE.getKeyValuePair(), UnionType.STRING_OR_STRING_ARRAY)),
List.of(
"[foo, {bar: baz}]", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING),
List.of(
"{bar: baz}",
LfPackage.eINSTANCE.getKeyValuePair(),
UnionType.STRING_OR_STRING_ARRAY)),
UnionType.PLATFORM_STRING_OR_DICTIONARY,
List.of(
List.of("[bar, baz]", LfPackage.eINSTANCE.getKeyValuePair(), UnionType.PLATFORM_STRING_OR_DICTIONARY),
List.of("{name: [1, 2, 3]}", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING),
List.of("{name: {bar: baz}}", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING),
List.of("{board: [1, 2, 3]}", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING),
List.of("{board: {bar: baz}}", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING),
List.of(
"{baud-rate: [1, 2, 3]}", LfPackage.eINSTANCE.getElement(), PrimitiveType.NON_NEGATIVE_INTEGER),
"[bar, baz]",
LfPackage.eINSTANCE.getKeyValuePair(),
UnionType.PLATFORM_STRING_OR_DICTIONARY),
List.of(
"{name: [1, 2, 3]}", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING),
List.of(
"{name: {bar: baz}}", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING),
List.of(
"{board: [1, 2, 3]}", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING),
List.of(
"{board: {bar: baz}}",
LfPackage.eINSTANCE.getElement(),
PrimitiveType.STRING),
List.of(
"{baud-rate: [1, 2, 3]}",
LfPackage.eINSTANCE.getElement(),
PrimitiveType.NON_NEGATIVE_INTEGER),
List.of(
"{baud-rate: {bar: baz}}", LfPackage.eINSTANCE.getElement(), PrimitiveType.NON_NEGATIVE_INTEGER)),
"{baud-rate: {bar: baz}}",
LfPackage.eINSTANCE.getElement(),
PrimitiveType.NON_NEGATIVE_INTEGER)),
UnionType.FILE_OR_FILE_ARRAY,
List.of(
List.of("[1 msec]", LfPackage.eINSTANCE.getElement(), PrimitiveType.FILE),
List.of("[foo, {bar: baz}]", LfPackage.eINSTANCE.getElement(), PrimitiveType.FILE),
List.of("{bar: baz}", LfPackage.eINSTANCE.getKeyValuePair(), UnionType.FILE_OR_FILE_ARRAY)),
List.of(
"[foo, {bar: baz}]", LfPackage.eINSTANCE.getElement(), PrimitiveType.FILE),
List.of(
"{bar: baz}",
LfPackage.eINSTANCE.getKeyValuePair(),
UnionType.FILE_OR_FILE_ARRAY)),
UnionType.DOCKER_UNION,
List.of(
List.of("foo", LfPackage.eINSTANCE.getKeyValuePair(), UnionType.DOCKER_UNION),
List.of("[1]", LfPackage.eINSTANCE.getKeyValuePair(), UnionType.DOCKER_UNION),
List.of("{bar: baz}", LfPackage.eINSTANCE.getKeyValuePair(), DictionaryType.DOCKER_DICT),
List.of("{FROM: [1, 2, 3]}", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING)),
List.of(
"{bar: baz}",
LfPackage.eINSTANCE.getKeyValuePair(),
DictionaryType.DOCKER_DICT),
List.of(
"{FROM: [1, 2, 3]}", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING)),
UnionType.TRACING_UNION,
List.of(
List.of("foo", LfPackage.eINSTANCE.getKeyValuePair(), UnionType.TRACING_UNION),
List.of("[1]", LfPackage.eINSTANCE.getKeyValuePair(), UnionType.TRACING_UNION),
List.of("{bar: baz}", LfPackage.eINSTANCE.getKeyValuePair(), DictionaryType.TRACING_DICT),
List.of(
"{trace-file-name: [1, 2, 3]}", LfPackage.eINSTANCE.getElement(), PrimitiveType.STRING)));
"{bar: baz}",
LfPackage.eINSTANCE.getKeyValuePair(),
DictionaryType.TRACING_DICT),
List.of(
"{trace-file-name: [1, 2, 3]}",
LfPackage.eINSTANCE.getElement(),
PrimitiveType.STRING)));

/**
* Given an array type, return a list of good or bad examples, depending on the value of the
Expand Down Expand Up @@ -1496,12 +1528,12 @@ public Collection<DynamicTest> checkTargetProperties() throws Exception {
DynamicTest.dynamicTest(
"Property %s (%s) - known bad assignment: %s".formatted(property, type, it),
() -> {
validator.assertError(
createModel(property, it),
LfPackage.eINSTANCE.getKeyValuePair(),
null,
String.format(
"Target property '%s' is required to be %s.", property, type));
validator.assertError(
createModel(property, it),
LfPackage.eINSTANCE.getKeyValuePair(),
null,
String.format(
"Target property '%s' is required to be %s.", property, type));
});
result.add(test);
}
Expand All @@ -1515,14 +1547,14 @@ public Collection<DynamicTest> checkTargetProperties() throws Exception {
"Property %s (%s) - known bad assignment: %s".formatted(property, type, it),
() -> {
System.out.println(it);
//var issues = validator.validate(createModel(property, it.get(0).toString()));
// var issues = validator.validate(createModel(property,
// it.get(0).toString()));
if (it.get(1).equals(LfPackage.eINSTANCE.getElement())) {
validator.assertError(
createModel(property, it.get(0).toString()),
LfPackage.eINSTANCE.getElement(),
null,
String.format(
"Entry is required to be %s.", it.get(2)));
String.format("Entry is required to be %s.", it.get(2)));
} else {
validator.assertError(
createModel(property, it.get(0).toString()),
Expand All @@ -1531,10 +1563,10 @@ public Collection<DynamicTest> checkTargetProperties() throws Exception {
String.format(
"Target property '%s' is required to be %s.", property, type));
}

});
// String.format(
// "Target property '%s' is required to be %s.", property, type)
// "Target property '%s' is required to be %s.", property,
// type)
result.add(test);
}
}
Expand Down

0 comments on commit 20e7b3f

Please sign in to comment.