use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class ConcourseEditorTest method reconcileUnusedResources.
@Test
public void reconcileUnusedResources() throws Exception {
Editor editor;
editor = harness.newEditor("resources:\n" + "- name: version\n" + " type: semver\n" + "- name: source-repo\n" + " type: git\n" + "jobs:\n" + "- name: build-it\n" + " plan:\n" + " - get: version\n");
Diagnostic p = editor.assertProblems("source-repo|Unused 'Resource'").get(0);
assertEquals(DiagnosticSeverity.Error, p.getSeverity());
editor = harness.newEditor("resources:\n" + "- name: not-used\n" + " type: pool\n" + "- name: version\n" + " type: semver\n" + "- name: source-repo\n" + " type: git\n" + " source:\n" + " branch: master\n" + " uri: git@someplace.com:blah/blah.git\n" + "jobs:\n" + "- name: build-it\n" + " plan:\n" + " - aggregate:\n" + // <-- This isn't a real use but looks like one!
" - get: not-used\n" + " resource: version\n" + " - put: source-repo\n");
editor.assertProblems("not-used|Unused 'Resource'");
}
use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class ConcourseEditorTest method poolResourceGetParamsReconcileAndHovers.
@Test
public void poolResourceGetParamsReconcileAndHovers() throws Exception {
Editor editor;
editor = harness.newEditor("resources:\n" + "- name: my-locks\n" + " type: pool\n" + "jobs:\n" + "- name: a-job\n" + " plan:\n" + " - get: my-locks\n" + " params:\n" + " no-params-expected: bad");
editor.assertProblems("no-params-expected|Unknown property");
}
use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class ConcourseEditorTest method taskRunPropertiesValidationAndHovers.
@Test
public void taskRunPropertiesValidationAndHovers() throws Exception {
Editor editor;
editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "inputs:\n" + "- name: sts4\n" + "outputs:\n" + "- name: vsix-files\n" + "platform: linux\n" + "image_resource:\n" + " type: docker-image\n" + " source:\n" + " repository: kdvolder/sts4-build-env\n" + "run:\n" + " path: sts4/concourse/tasks/build-vscode-extensions.sh\n" + " args: the-args\n" + " user: admin\n" + " dir: the-dir\n" + " bogus: bad\n");
editor.assertProblems("the-args|Expecting a 'Sequence'", "bogus|Unknown property");
editor.assertHoverContains("path", "The command to execute, relative to the task's working directory");
editor.assertHoverContains("args", "Arguments to pass to the command");
editor.assertHoverContains("dir", "A directory, relative to the initial working directory, to set as the working directory");
editor.assertHoverContains("user", "Explicitly set the user to run as");
editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "inputs:\n" + "- name: sts4\n" + "outputs:\n" + "- name: vsix-files\n" + "platform: linux\n" + "image_resource:\n" + " type: docker-image\n" + " source:\n" + " repository: kdvolder/sts4-build-env\n" + "run:\n" + " user: admin\n");
editor.assertProblems("run|'path' is required");
}
use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class ConcourseEditorTest method addSingleRequiredPropertiesQuickfix.
@Test
public void addSingleRequiredPropertiesQuickfix() throws Exception {
Editor editor = harness.newEditor("resources:\n" + "- name: foo\n" + " source:\n" + " username: someone\n" + "# Confuse");
Diagnostic problem = editor.assertProblems("-|'type' is required", "foo|Unused").get(0);
CodeAction quickfix = editor.assertCodeAction(problem);
assertEquals("Add property 'type'", quickfix.getLabel());
quickfix.perform();
editor.assertText("resources:\n" + "- name: foo\n" + " source:\n" + " username: someone\n" + " type: <*>\n" + "# Confuse");
}
use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class ConcourseEditorTest method taskFileMissingToplevelPropertiesUnderlinesLastNonWhitespaceChar.
@Test
public void taskFileMissingToplevelPropertiesUnderlinesLastNonWhitespaceChar() throws Exception {
Editor editor;
editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "rootfs_uri: some-image");
editor.assertProblems("rootfs_uri: some-imag^e^|[platform, run] are required");
editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "rootfs_uri: some-image\n" + " \n");
editor.assertProblems("rootfs_uri: some-imag^e^|[platform, run] are required");
}
Aggregations