Skip to content

Commit

Permalink
Install protoc to run tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rcorre committed Oct 2, 2024
1 parent d8ef7f1 commit f012d14
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@ jobs:

runs-on: ubuntu-latest

env:
RUST_LOG: pbls=trace

steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Install protoc
run: |
curl https://github.com/protocolbuffers/protobuf/releases/download/v28.2/protoc-28.2-linux-x86_64.zip -Lo /tmp/protoc.zip
unzip /tmp/protoc.zip
bin/protoc --version
- name: Run tests
run: cargo test --verbose
run: PATH="$PATH:bin/" cargo test --verbose
27 changes: 11 additions & 16 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ fn error_uri() -> Url {
Url::from_file_path(std::fs::canonicalize("./testdata/error.proto").unwrap()).unwrap()
}

fn stuff_uri() -> Url {
Url::from_file_path(std::fs::canonicalize("./testdata/folder/stuff.proto").unwrap()).unwrap()
}

fn diag(uri: Url, target: &str, message: &str) -> Diagnostic {
Diagnostic {
range: locate_sym(uri, target).range,
Expand Down Expand Up @@ -516,7 +520,7 @@ fn test_workspace_symbols() -> pbls::Result<()> {
sym(error_uri(), "Nope", "enum Nope"),
sym(error_uri(), "Nah", "message Nah"),
sym(error_uri(), "Noo", "message Noo"),
// sym(stuff_uri(), "Stuff", "message Stuff"), BUG: should find nested symbols
sym(stuff_uri(), "Stuff", "message Stuff"),
],
);

Expand Down Expand Up @@ -714,21 +718,12 @@ fn test_complete_import() -> pbls::Result<()> {
// excludes dep.proto (already imported)
assert_elements_equal(
actual,
vec![
CompletionItem {
label: "error.proto".into(),
kind: Some(CompletionItemKind::FILE),
insert_text: Some("error.proto\";".into()),
..Default::default()
},
// BUG: Should be excluded
CompletionItem {
label: "folder/stuff.proto".into(),
kind: Some(CompletionItemKind::FILE),
insert_text: Some("folder/stuff.proto\";".into()),
..Default::default()
},
],
vec![CompletionItem {
label: "error.proto".into(),
kind: Some(CompletionItemKind::FILE),
insert_text: Some("error.proto\";".into()),
..Default::default()
}],
|s| s.label.clone(),
);

Expand Down

0 comments on commit f012d14

Please sign in to comment.