-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1107 from rbartlensky/fix-rust2018-submodule-search
Fix #1052.
- Loading branch information
Showing
7 changed files
with
129 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,6 @@ impl TestStruct { | |
} | ||
|
||
pub(crate) fn name() {} | ||
|
||
pub mod submod; | ||
pub mod submod2018; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod foo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod foo2018; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
use racer_testutils::*; | ||
|
||
#[test] | ||
fn finds_old_type_of_submodule() { | ||
let src = " | ||
use submod::f~oo; | ||
"; | ||
|
||
with_test_project(|dir| { | ||
let srcdir = dir.nested_dir("src"); | ||
let got = get_definition(src, Some(srcdir)); | ||
assert_eq!(got.matchstr, "foo"); | ||
assert!(got.filepath.ends_with("src/submod/foo.rs")); | ||
}) | ||
} | ||
|
||
#[test] | ||
fn finds_old_type_of_module() { | ||
let src = " | ||
use s~ubmod::foo; | ||
"; | ||
|
||
with_test_project(|dir| { | ||
let srcdir = dir.nested_dir("src"); | ||
let got = get_definition(src, Some(srcdir)); | ||
assert_eq!(got.matchstr, "submod"); | ||
assert!(got.filepath.ends_with("src/submod/mod.rs")); | ||
}) | ||
} | ||
|
||
#[test] | ||
fn finds_new_type_of_module() { | ||
let src = " | ||
use s~ubmod2018::foo2018; | ||
"; | ||
|
||
with_test_project(|dir| { | ||
let srcdir = dir.nested_dir("src"); | ||
let got = get_definition(src, Some(srcdir)); | ||
assert_eq!(got.matchstr, "submod2018"); | ||
assert!(got.filepath.ends_with("src/submod2018.rs")); | ||
}) | ||
} | ||
|
||
#[test] | ||
fn finds_new_type_of_submodule() { | ||
let src = " | ||
use submod2018::f~oo2018; | ||
"; | ||
|
||
with_test_project(|dir| { | ||
let srcdir = dir.nested_dir("src"); | ||
let got = get_definition(src, Some(srcdir)); | ||
assert_eq!(got.matchstr, "foo2018"); | ||
assert!(got.filepath.ends_with("src/submod2018/foo2018.rs")); | ||
}) | ||
} |