Skip to content

Commit

Permalink
DON'T MERGE: adding tests (#26)
Browse files Browse the repository at this point in the history
Issues covered:
- vala-language-server#57
- vala-language-server#106
- vala-language-server#138
- vala-language-server#153
  • Loading branch information
Prince781 committed Mar 20, 2022
1 parent ef22ab2 commit 428a8e2
Show file tree
Hide file tree
Showing 10 changed files with 171 additions and 202 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/
*.o
subprojects/lstf
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ if get_option('plugins')
endif

if get_option('tests')
subdir('test')
subdir('tests')
endif
6 changes: 6 additions & 0 deletions subprojects/lstf.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[wrap-git]
url = https://github.com/Prince781/lstf
revision = head

# [provide]
# program_names = lstf
8 changes: 0 additions & 8 deletions test/meson.build

This file was deleted.

193 changes: 0 additions & 193 deletions test/testclient.vala

This file was deleted.

25 changes: 25 additions & 0 deletions tests/106-autocompletion-in-string-literals.lstf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// issue: vala-language-server#106
server_path = option('server-path');

let f = file(`
void main() {
print ("this is a string");
}
`);

project_files = [ f ];



await change(f, {
range: {
start: { line: 2, character: 29 },
end: { line: 2, character: 29 }
},
text: '.'
});

assert {
isIncomplete: false,
items: []
} <=> await completion(f, 2, 29);
35 changes: 35 additions & 0 deletions tests/138-suggest-overridable-symbols.lstf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// issue: vala-language-server#138
server_path = options('server-path');

let f = file(`
interface Iface {
public abstract void must_override();
}
class Sas : Iface, Object {

}
`);

project_files = [ f ];



await change(f, {
range: {
start: { line: 7, character: 5 },
end: { line: 7, character: 5 }
},
text: '\n p'
});

assert {
isIncomplete: false,
completions: [
{
label: 'public void must_override()',
kind: CompletionItemKind.Method,
insertText: 'public void must_override()$0',
insertTextFormat: InsertTextFormat.Snippet
}
]
} <=> await completion(f, 8, 6);
32 changes: 32 additions & 0 deletions tests/153-signaturehelp-shared-prefix.lstf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// issue: vala-language-server#153
server_path = option('server-path');

let f = file(`
void foo (int arg1, int arg2) {
}
void main() {
foo
}
`);

project_files = [ f ];



await change(f, {
range: {
start: { line: 4, character: 7 },
end: { line: 4, character: 7 }
},
text: ' ('
});

assert {
signatures: [
{
label: 'void foo(int arg1, int arg2)',
parameters: [ { label: 'int arg1' } ]
}
],
activeParameter: 0
} <=> await signatureHelp(f, 4, 9);
49 changes: 49 additions & 0 deletions tests/57-suggest-overridable-symbols.lstf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// issue: vala-language-server#57
server_path = option('server-path');

let f = file(`
interface Iface {
public abstract void must_override1();
public abstract void must_override2(int arg1);
public abstract void must_override3(int arg1, bool arg2);
}
class Sas : Iface, Object {

}
`);

project_files = [ f ];



await change(f, {
range: {
start: { line: 7, character: 5 },
end: { line: 7, character: 5 }
},
text: 'p'
});

assert {
isIncomplete: false,
completions: [
{
label: 'public void must_override1()',
kind: CompletionItemKind.Method,
insertText: 'public void must_override1()$0',
insertTextFormat: InsertTextFormat.Snippet,
},
{
label: 'public void must_override2(int arg1)',
kind: CompletionItemKind.Method,
insertText: 'public void must_override2(int ${1:arg1})$0',
insertTextFormat: InsertTextFormat.Snippet,
},
{
label: 'public void must_override3(int arg1, bool arg2)',
kind: CompletionItemKind.Method,
insertText: 'public void must_override3(int ${1:arg1}, bool ${2:arg2})$0',
insertTextFormat: InsertTextFormat.Snippet
}
]
} <=> await completion(f, 7, 5);
22 changes: 22 additions & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
lstf = find_program('lstf', required: false)

if not lstf.found()
meson.override_find_program('lstf', subproject('lstf').get_variable('lstf'))
lstf = find_program('lstf')
endif

test('57-suggest-overridable-symbols', lstf,
workdir: meson.current_source_dir(),
args: ['57-suggest-overridable-symbols.lstf', '--server-path', vls])

test('106-autocompletion-in-string-literals', lstf,
workdir: meson.current_source_dir(),
args: ['106-autocompletion-in-string-literals.lstf', '--server-path', vls])

test('138-suggest-overridable-symbols', lstf,
workdir: meson.current_source_dir(),
args: ['138-suggest-overridable-symbols.lstf', '--server-path', vls])

test('153-signaturehelp-shared-prefix', lstf,
workdir: meson.current_source_dir(),
args: ['153-signaturehelp-shared-prefix.lstf', '--server-path', vls])

0 comments on commit 428a8e2

Please sign in to comment.