Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding tests (#26) #203

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -80,5 +80,5 @@ subdir('data')
subdir('src')

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.

200 changes: 0 additions & 200 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);
17 changes: 17 additions & 0 deletions tests/diagnostics.lstf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
server_path = option('server-path');
let f = file(`void main(string args[]) {}`);
project_files = [ f ];

assert {
diagnostics: [
...,
{
range: {
start: { line: 3, character: 5 },
end: { line: 3, character: 16 }
},
severity: DiagnosticSeverity.Error
},
...
]
} <=> await diagnostics(f);
Loading
Loading