aboutsummaryrefslogtreecommitdiff
path: root/crates/test_utils
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-23 17:43:55 +0100
committerAleksey Kladov <[email protected]>2020-06-23 17:43:55 +0100
commit3486b47e5c4f71479cc3c876da1fd1dcbfcab257 (patch)
treed7e2a7e46f9a234bcd8edb1e95865be262c2930d /crates/test_utils
parent21f751a0e5da5dd488612e25abfc545c259050e7 (diff)
Simplify
Diffstat (limited to 'crates/test_utils')
-rw-r--r--crates/test_utils/src/fixture.rs13
-rw-r--r--crates/test_utils/src/lib.rs2
2 files changed, 1 insertions, 14 deletions
diff --git a/crates/test_utils/src/fixture.rs b/crates/test_utils/src/fixture.rs
index bda826d50..25d80806b 100644
--- a/crates/test_utils/src/fixture.rs
+++ b/crates/test_utils/src/fixture.rs
@@ -13,19 +13,6 @@ pub struct FixtureEntry {
13 pub env: FxHashMap<String, String>, 13 pub env: FxHashMap<String, String>,
14} 14}
15 15
16/// Same as `parse_fixture`, except it allow empty fixture
17pub fn parse_single_fixture(ra_fixture: &str) -> Option<FixtureEntry> {
18 if !ra_fixture.lines().any(|it| it.trim_start().starts_with("//-")) {
19 return None;
20 }
21
22 let fixtures = parse_fixture(ra_fixture);
23 if fixtures.len() > 1 {
24 panic!("too many fixtures");
25 }
26 fixtures.into_iter().nth(0)
27}
28
29/// Parses text which looks like this: 16/// Parses text which looks like this:
30/// 17///
31/// ```not_rust 18/// ```not_rust
diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs
index 0fdd1a36b..d44b2f9ab 100644
--- a/crates/test_utils/src/lib.rs
+++ b/crates/test_utils/src/lib.rs
@@ -22,7 +22,7 @@ pub use difference::Changeset as __Changeset;
22pub use ra_cfg::CfgOptions; 22pub use ra_cfg::CfgOptions;
23pub use rustc_hash::FxHashMap; 23pub use rustc_hash::FxHashMap;
24 24
25pub use crate::fixture::{parse_fixture, parse_single_fixture, FixtureEntry}; 25pub use crate::fixture::{parse_fixture, FixtureEntry};
26 26
27pub const CURSOR_MARKER: &str = "<|>"; 27pub const CURSOR_MARKER: &str = "<|>";
28 28