This repository has been archived by the owner on Oct 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 205
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 #483 from nrc/rust-field
Fix a bug which causes field and variable references to be self-links
- Loading branch information
Showing
3 changed files
with
32 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from dxr.testing import SingleFileTestCase | ||
|
||
class RustSingleFileTestCase(SingleFileTestCase): | ||
"""Test case suited to testing the Rust plugin.""" | ||
source_filename = 'mod.rs' | ||
|
||
@classmethod | ||
def config_input(cls, config_dir_path): | ||
config = super(RustSingleFileTestCase, cls).config_input(config_dir_path) | ||
|
||
config['DXR']['enabled_plugins'] = 'pygmentize rust' | ||
config['code']['build_command'] = '$RUSTC mod.rs' | ||
|
||
return config |
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,17 @@ | ||
from dxr.plugins.rust.tests import RustSingleFileTestCase | ||
from dxr.testing import menu_on | ||
|
||
class VarMenuTests(RustSingleFileTestCase): | ||
source = """ | ||
fn main() { | ||
let _ = FOO; | ||
} | ||
const FOO: i32 = 42; | ||
""" | ||
|
||
def test_const_link(self): | ||
""" test that the link to defintion works properly """ | ||
menu_on(self.source_page('mod.rs'), | ||
'FOO', | ||
{'html': 'Jump to definition', | ||
'href': '/code/source/mod.rs#5'}) |