fix:(adapter): change format of test item id and name

This commit is contained in:
kbwo 2024-08-07 00:11:19 +09:00
parent 56c97a4780
commit 319e3b69d8
3 changed files with 20 additions and 14 deletions

View file

@ -255,8 +255,8 @@ mod tests {
assert_eq!(
test_items,
vec![TestItem {
id: String::from("index:fail"),
name: String::from("index:fail"),
id: String::from("index::fail"),
name: String::from("index::fail"),
start_position: Range {
start: Position {
line: 1,

View file

@ -52,10 +52,16 @@ pub fn detect_workspaces_from_file_paths(
let workspace =
detect_workspace_from_file(PathBuf::from_str(&file_path).unwrap(), file_names);
if let Some(workspace) = workspace {
result_map
.entry(workspace)
.or_default()
.push(file_path.clone());
if result_map
.get(&workspace)
.map(|v| !v.contains(&file_path))
.unwrap_or(true)
{
result_map
.entry(workspace)
.or_default()
.push(file_path.clone());
}
}
}
result_map
@ -151,14 +157,14 @@ pub fn discover_with_treesitter(
test_end_position = end_position;
}
"test.name" => {
let test_name = if namespace.is_empty() {
let test_id = if namespace.is_empty() {
value.to_string()
} else {
[namespace, value].join(":")
[namespace, value].join("::")
};
let test_item = TestItem {
id: test_name.clone(),
name: test_name,
id: test_id.clone(),
name: test_id,
start_position: Range {
start: Position {
line: test_start_position.row as u32,

View file

@ -213,8 +213,8 @@ mod tests {
test_items,
vec![
TestItem {
id: "describe text:pass".to_string(),
name: "describe text:pass".to_string(),
id: "describe text::pass".to_string(),
name: "describe text::pass".to_string(),
start_position: Range {
start: Position {
line: 4,
@ -237,8 +237,8 @@ mod tests {
}
},
TestItem {
id: "describe text:fail".to_string(),
name: "describe text:fail".to_string(),
id: "describe text::fail".to_string(),
name: "describe text::fail".to_string(),
start_position: Range {
start: Position {
line: 8,