Fix tests
This commit is contained in:
parent
a83ab820a4
commit
bc3db7c1de
@ -228,12 +228,38 @@ fn test_foo() {}
|
||||
@r###"
|
||||
[
|
||||
Runnable {
|
||||
range: 1..21,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 1..21,
|
||||
name: "main",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
12..16,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: Bin,
|
||||
cfg_exprs: [],
|
||||
},
|
||||
Runnable {
|
||||
range: 22..46,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 22..46,
|
||||
name: "test_foo",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
33..41,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: Test {
|
||||
test_id: Path(
|
||||
"test_foo",
|
||||
@ -245,7 +271,20 @@ fn test_foo() {}
|
||||
cfg_exprs: [],
|
||||
},
|
||||
Runnable {
|
||||
range: 47..81,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 47..81,
|
||||
name: "test_foo",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
68..76,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: Test {
|
||||
test_id: Path(
|
||||
"test_foo",
|
||||
@ -280,12 +319,38 @@ fn foo() {}
|
||||
@r###"
|
||||
[
|
||||
Runnable {
|
||||
range: 1..21,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 1..21,
|
||||
name: "main",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
12..16,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: Bin,
|
||||
cfg_exprs: [],
|
||||
},
|
||||
Runnable {
|
||||
range: 22..64,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 22..64,
|
||||
name: "foo",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
56..59,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: DocTest {
|
||||
test_id: Path(
|
||||
"foo",
|
||||
@ -320,12 +385,38 @@ fn foo() {}
|
||||
@r###"
|
||||
[
|
||||
Runnable {
|
||||
range: 1..21,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 1..21,
|
||||
name: "main",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
12..16,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: Bin,
|
||||
cfg_exprs: [],
|
||||
},
|
||||
Runnable {
|
||||
range: 51..105,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 51..105,
|
||||
name: "foo",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
97..100,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: DocTest {
|
||||
test_id: Path(
|
||||
"Data::foo",
|
||||
@ -355,14 +446,40 @@ fn test_foo1() {}
|
||||
@r###"
|
||||
[
|
||||
Runnable {
|
||||
range: 1..59,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 1..59,
|
||||
name: "test_mod",
|
||||
kind: MODULE,
|
||||
focus_range: Some(
|
||||
13..21,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: TestMod {
|
||||
path: "test_mod",
|
||||
},
|
||||
cfg_exprs: [],
|
||||
},
|
||||
Runnable {
|
||||
range: 28..57,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 28..57,
|
||||
name: "test_foo1",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
43..52,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: Test {
|
||||
test_id: Path(
|
||||
"test_mod::test_foo1",
|
||||
@ -397,14 +514,40 @@ fn test_foo1() {}
|
||||
@r###"
|
||||
[
|
||||
Runnable {
|
||||
range: 23..85,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 23..85,
|
||||
name: "test_mod",
|
||||
kind: MODULE,
|
||||
focus_range: Some(
|
||||
27..35,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: TestMod {
|
||||
path: "foo::test_mod",
|
||||
},
|
||||
cfg_exprs: [],
|
||||
},
|
||||
Runnable {
|
||||
range: 46..79,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 46..79,
|
||||
name: "test_foo1",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
65..74,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: Test {
|
||||
test_id: Path(
|
||||
"foo::test_mod::test_foo1",
|
||||
@ -441,14 +584,40 @@ fn test_foo1() {}
|
||||
@r###"
|
||||
[
|
||||
Runnable {
|
||||
range: 41..115,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 41..115,
|
||||
name: "test_mod",
|
||||
kind: MODULE,
|
||||
focus_range: Some(
|
||||
45..53,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: TestMod {
|
||||
path: "foo::bar::test_mod",
|
||||
},
|
||||
cfg_exprs: [],
|
||||
},
|
||||
Runnable {
|
||||
range: 68..105,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 68..105,
|
||||
name: "test_foo1",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
91..100,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: Test {
|
||||
test_id: Path(
|
||||
"foo::bar::test_mod::test_foo1",
|
||||
@ -480,7 +649,20 @@ fn test_foo1() {}
|
||||
@r###"
|
||||
[
|
||||
Runnable {
|
||||
range: 1..58,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 1..58,
|
||||
name: "test_foo1",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
44..53,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: Test {
|
||||
test_id: Path(
|
||||
"test_foo1",
|
||||
@ -517,7 +699,20 @@ fn test_foo1() {}
|
||||
@r###"
|
||||
[
|
||||
Runnable {
|
||||
range: 1..80,
|
||||
nav: NavigationTarget {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 1..80,
|
||||
name: "test_foo1",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
66..75,
|
||||
),
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
},
|
||||
kind: Test {
|
||||
test_id: Path(
|
||||
"test_foo1",
|
||||
|
@ -139,6 +139,7 @@ pub enum RunnableKind {
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CargoRunnable {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub workspace_root: Option<PathBuf>,
|
||||
// command, --package and --lib stuff
|
||||
pub cargo_args: Vec<String>,
|
||||
|
@ -76,30 +76,33 @@ fn foo() {
|
||||
server.request::<Runnables>(
|
||||
RunnablesParams { text_document: server.doc_id("lib.rs"), position: None },
|
||||
json!([
|
||||
{
|
||||
"args": [ "test" ],
|
||||
"extraArgs": [ "foo", "--nocapture" ],
|
||||
"kind": "cargo",
|
||||
"env": { "RUST_BACKTRACE": "short" },
|
||||
"cwd": null,
|
||||
"label": "test foo",
|
||||
"range": {
|
||||
"end": { "character": 1, "line": 2 },
|
||||
"start": { "character": 0, "line": 0 }
|
||||
{
|
||||
"args": {
|
||||
"cargoArgs": ["test"],
|
||||
"executableArgs": ["foo", "--nocapture"],
|
||||
},
|
||||
"kind": "cargo",
|
||||
"label": "test foo",
|
||||
"location": {
|
||||
"targetRange": {
|
||||
"end": { "character": 1, "line": 2 },
|
||||
"start": { "character": 0, "line": 0 }
|
||||
},
|
||||
"targetSelectionRange": {
|
||||
"end": { "character": 6, "line": 1 },
|
||||
"start": { "character": 3, "line": 1 }
|
||||
},
|
||||
"targetUri": "file:///[..]/lib.rs"
|
||||
}
|
||||
},
|
||||
{
|
||||
"args": {
|
||||
"cargoArgs": ["check", "--workspace"],
|
||||
"executableArgs": [],
|
||||
},
|
||||
"kind": "cargo",
|
||||
"label": "cargo check --workspace"
|
||||
}
|
||||
},
|
||||
{
|
||||
"args": ["check", "--workspace"],
|
||||
"extraArgs": [],
|
||||
"kind": "cargo",
|
||||
"env": {},
|
||||
"cwd": null,
|
||||
"label": "cargo check --workspace",
|
||||
"range": {
|
||||
"end": { "character": 0, "line": 0 },
|
||||
"start": { "character": 0, "line": 0 }
|
||||
}
|
||||
}
|
||||
]),
|
||||
);
|
||||
}
|
||||
@ -138,42 +141,44 @@ fn main() {}
|
||||
server.request::<Runnables>(
|
||||
RunnablesParams { text_document: server.doc_id("foo/tests/spam.rs"), position: None },
|
||||
json!([
|
||||
{
|
||||
"args": [ "test", "--package", "foo", "--test", "spam" ],
|
||||
"extraArgs": [ "test_eggs", "--exact", "--nocapture" ],
|
||||
"kind": "cargo",
|
||||
"env": { "RUST_BACKTRACE": "short" },
|
||||
"label": "test test_eggs",
|
||||
"range": {
|
||||
{
|
||||
"args": {
|
||||
"cargoArgs": ["test", "--package", "foo", "--test", "spam"],
|
||||
"executableArgs": ["test_eggs", "--exact", "--nocapture"],
|
||||
"workspaceRoot": server.path().join("foo")
|
||||
},
|
||||
"kind": "cargo",
|
||||
"label": "test test_eggs",
|
||||
"location": {
|
||||
"targetRange": {
|
||||
"end": { "character": 17, "line": 1 },
|
||||
"start": { "character": 0, "line": 0 }
|
||||
},
|
||||
"cwd": server.path().join("foo")
|
||||
},
|
||||
{
|
||||
"args": [ "check", "--package", "foo" ],
|
||||
"extraArgs": [],
|
||||
"kind": "cargo",
|
||||
"env": {},
|
||||
"label": "cargo check -p foo",
|
||||
"range": {
|
||||
"end": { "character": 0, "line": 0 },
|
||||
"start": { "character": 0, "line": 0 }
|
||||
"targetSelectionRange": {
|
||||
"end": { "character": 12, "line": 1 },
|
||||
"start": { "character": 3, "line": 1 }
|
||||
},
|
||||
"cwd": server.path().join("foo")
|
||||
},
|
||||
{
|
||||
"args": [ "test", "--package", "foo" ],
|
||||
"extraArgs": [],
|
||||
"kind": "cargo",
|
||||
"env": {},
|
||||
"label": "cargo test -p foo",
|
||||
"range": {
|
||||
"end": { "character": 0, "line": 0 },
|
||||
"start": { "character": 0, "line": 0 }
|
||||
},
|
||||
"cwd": server.path().join("foo")
|
||||
"targetUri": "file:///[..]/tests/spam.rs"
|
||||
}
|
||||
},
|
||||
{
|
||||
"args": {
|
||||
"cargoArgs": ["check", "--package", "foo"],
|
||||
"executableArgs": [],
|
||||
"workspaceRoot": server.path().join("foo")
|
||||
},
|
||||
"kind": "cargo",
|
||||
"label": "cargo check -p foo"
|
||||
},
|
||||
{
|
||||
"args": {
|
||||
"cargoArgs": ["test", "--package", "foo"],
|
||||
"executableArgs": [],
|
||||
"workspaceRoot": server.path().join("foo")
|
||||
},
|
||||
"kind": "cargo",
|
||||
"label": "cargo test -p foo"
|
||||
}
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user