Skip to content

Commit 02a97b0

Browse files
committed
test(els): add ELS test suites
1 parent f69e45f commit 02a97b0

File tree

7 files changed

+622
-7
lines changed

7 files changed

+622
-7
lines changed

Cargo.lock

Lines changed: 111 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/els/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ serde = { version = "1.0", features = ["derive"] }
2727
serde_json = "1.0.85"
2828
lsp-types = { version = "0.93.2", features = ["proposed"] }
2929

30+
[dev-dependencies]
31+
gag = "1"
32+
3033
[lib]
3134
path = "lib.rs"
3235

crates/els/file_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl FileCacheEntry {
4646

4747
/// Stores the contents of the file on-memory.
4848
/// This struct can save changes in real-time & incrementally.
49-
#[derive(Debug, Clone)]
49+
#[derive(Debug, Clone, Default)]
5050
pub struct FileCache {
5151
pub files: Shared<Dict<NormalizedUrl, FileCacheEntry>>,
5252
}

crates/els/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ mod server;
1818
mod sig_help;
1919
mod util;
2020
pub use server::*;
21+
pub use util::*;

crates/els/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ impl AnalysisResult {
197197
}
198198
}
199199

200-
pub(crate) const TRIGGER_CHARS: [&str; 4] = [".", ":", "(", " "];
200+
pub const TRIGGER_CHARS: [&str; 4] = [".", ":", "(", " "];
201201

202202
#[derive(Debug, Clone, Default)]
203203
pub struct AnalysisResultCache(Shared<Dict<NormalizedUrl, AnalysisResult>>);
@@ -664,7 +664,7 @@ impl<Checker: BuildRunnable, Parser: Parsable> Server<Checker, Parser> {
664664
Ok(Value::from_str(&s)?)
665665
}
666666

667-
fn dispatch(&mut self, msg: Value) -> ELSResult<()> {
667+
pub fn dispatch(&mut self, msg: Value) -> ELSResult<()> {
668668
match (
669669
msg.get("id").and_then(|i| i.as_i64()),
670670
msg.get("method").and_then(|m| m.as_str()),

crates/els/tests/a.er

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
x = 1
2+
_ = x + 1

0 commit comments

Comments
 (0)