Skip to content

Commit a019377

Browse files
committed
Adjust unit tests
Signed-off-by: BoykoAlex <alex.boyko@broadcom.com>
1 parent a831c66 commit a019377

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

headless-services/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/reconcile/SchemaBasedYamlASTReconciler.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,20 @@ private void parse(YamlFileAST ast, Node node, YType type, ValueParser parser) {
268268
}
269269

270270
private static boolean isYttUsed(Node node) {
271-
if (node.getBlockComments() != null) {
272-
return node.getBlockComments().stream().anyMatch(cl -> cl.getValue().trim().startsWith("@"));
271+
if (node.getBlockComments() != null
272+
&& node.getBlockComments().stream().anyMatch(cl -> isYttComment(cl.getValue()))) {
273+
return true;
274+
}
275+
if (node.getInLineComments() != null
276+
&& node.getInLineComments().stream().anyMatch(cl -> isYttComment(cl.getValue()))) {
277+
return true;
273278
}
274279
return false;
275280
}
281+
282+
private static boolean isYttComment(String s) {
283+
return s.startsWith("@ ");
284+
}
276285

277286
protected ReplacementQuickfix getValueReplacement(Exception _e) {
278287
if (_e instanceof ReconcileException) {

headless-services/concourse-language-server/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,17 @@ void reconcileResourceTypeType() throws Exception {
384384
);
385385
}
386386

387+
@Test
388+
void reconcileYttResourceType() throws Exception {
389+
Editor editor;
390+
editor = harness.newEditor(
391+
"resource_types:\n" +
392+
"- name: s3-multi\n" +
393+
" type: #@ resource.type\n"
394+
);
395+
editor.assertProblems();
396+
}
397+
387398
@Test
388399
void reconcileDisplayType() throws Exception {
389400
Editor editor;

0 commit comments

Comments
 (0)