aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cfg/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-05-24 14:34:35 +0100
committerGitHub <[email protected]>2020-05-24 14:34:35 +0100
commit130318b8231c2ad5a95fe3681dd32f0040f15255 (patch)
tree8d67b9cbad2b5f64e4135e626b80646bed851ca6 /crates/ra_cfg/src
parentf26b7928e065f067d7181d3425fe17526dc3bcd1 (diff)
parent27ed376bc4dfed39295af650effe63007e443b6f (diff)
Merge pull request #4548 from bnjjj/fix_4464
add support of feature flag for runnables
Diffstat (limited to 'crates/ra_cfg/src')
-rw-r--r--crates/ra_cfg/src/cfg_expr.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/ra_cfg/src/cfg_expr.rs b/crates/ra_cfg/src/cfg_expr.rs
index 39d71851c..85b100c6a 100644
--- a/crates/ra_cfg/src/cfg_expr.rs
+++ b/crates/ra_cfg/src/cfg_expr.rs
@@ -88,13 +88,17 @@ fn next_cfg_expr(it: &mut SliceIter<tt::TokenTree>) -> Option<CfgExpr> {
88mod tests { 88mod tests {
89 use super::*; 89 use super::*;
90 90
91 use mbe::ast_to_token_tree; 91 use mbe::{ast_to_token_tree, TokenMap};
92 use ra_syntax::ast::{self, AstNode}; 92 use ra_syntax::ast::{self, AstNode};
93 93
94 fn assert_parse_result(input: &str, expected: CfgExpr) { 94 fn get_token_tree_generated(input: &str) -> (tt::Subtree, TokenMap) {
95 let source_file = ast::SourceFile::parse(input).ok().unwrap(); 95 let source_file = ast::SourceFile::parse(input).ok().unwrap();
96 let tt = source_file.syntax().descendants().find_map(ast::TokenTree::cast).unwrap(); 96 let tt = source_file.syntax().descendants().find_map(ast::TokenTree::cast).unwrap();
97 let (tt, _) = ast_to_token_tree(&tt).unwrap(); 97 ast_to_token_tree(&tt).unwrap()
98 }
99
100 fn assert_parse_result(input: &str, expected: CfgExpr) {
101 let (tt, _) = get_token_tree_generated(input);
98 assert_eq!(parse_cfg(&tt), expected); 102 assert_eq!(parse_cfg(&tt), expected);
99 } 103 }
100 104