use super::*;
#[test]
fn opens_source_with_multibyte_escaped_strings_without_panicking() {
let source_text = r#"import bind from "classnames/bind";
import styles from "./styles.module.scss";
const cx = bind.bind(styles);
const label = "\λΉ";
export const view = <div className={cx("root", label && `μν-${tone}`)} />;
"#;
let mut state = LspShellState::default();
handle_lsp_message(
&mut state,
json!({
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"workspaceFolders": [
{
"uri": "file:///workspace-a",
"name": "workspace-a",
},
],
},
}),
);
handle_lsp_message(
&mut state,
json!({
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///workspace-a/src/App.tsx",
"languageId": "typescriptreact",
"version": 1,
"text": source_text,
},
},
}),
);
let source_index = state
.document("file:///workspace-a/src/App.tsx")
.map(|document| document.source_syntax_index.clone());
assert!(
source_index
.as_ref()
.is_some_and(|index| !index.selector_references.is_empty())
);
}