mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 04:45:01 +00:00
Rename Red Knot (#17820)
This commit is contained in:
parent
e6a798b962
commit
b51c4f82ea
1564 changed files with 1598 additions and 1578 deletions
31
crates/ty_wasm/tests/api.rs
Normal file
31
crates/ty_wasm/tests/api.rs
Normal file
|
@ -0,0 +1,31 @@
|
|||
#![cfg(target_arch = "wasm32")]
|
||||
|
||||
use ty_wasm::{Position, PositionEncoding, Workspace};
|
||||
use wasm_bindgen_test::wasm_bindgen_test;
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn check() {
|
||||
let mut workspace = Workspace::new(
|
||||
"/",
|
||||
PositionEncoding::Utf32,
|
||||
js_sys::JSON::parse("{}").unwrap(),
|
||||
)
|
||||
.expect("Workspace to be created");
|
||||
|
||||
workspace
|
||||
.open_file("test.py", "import random22\n")
|
||||
.expect("File to be opened");
|
||||
|
||||
let result = workspace.check().expect("Check to succeed");
|
||||
|
||||
assert_eq!(result.len(), 1);
|
||||
|
||||
let diagnostic = &result[0];
|
||||
|
||||
assert_eq!(diagnostic.id(), "lint:unresolved-import");
|
||||
assert_eq!(
|
||||
diagnostic.to_range(&workspace).unwrap().start,
|
||||
Position { line: 1, column: 8 }
|
||||
);
|
||||
assert_eq!(diagnostic.message(), "Cannot resolve import `random22`");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue