Skip to content

Commit 3cc2408

Browse files
tests: add tests to cover cfg_if mods
1 parent 19e8746 commit 3cc2408

File tree

13 files changed

+79
-0
lines changed

13 files changed

+79
-0
lines changed

src/test/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ const SKIP_FILE_WHITE_LIST: &[&str] = &[
3030
// These files and directory are a part of modules defined inside `cfg_if!`.
3131
"cfg_if/mod.rs",
3232
"cfg_if/detect",
33+
"issue-3253/foo.rs",
34+
"issue-3253/bar.rs",
35+
"issue-3253/paths",
3336
// These files and directory are a part of modules defined inside `cfg_attr(..)`.
3437
"cfg_mod/dir",
3538
"cfg_mod/bar.rs",

tests/source/issue-3253/bar.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Empty
2+
fn empty() {
3+
4+
}

tests/source/issue-3253/foo.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pub fn hello( )
2+
{
3+
println!("Hello World!");
4+
5+
}
6+

tests/source/issue-3253/lib.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#[macro_use]
2+
extern crate cfg_if;
3+
4+
cfg_if! {
5+
if #[cfg(target_family = "unix")] {
6+
mod foo;
7+
#[path = "paths/bar_foo.rs"]
8+
mod bar_foo;
9+
} else {
10+
mod bar;
11+
#[path = "paths/foo_bar.rs"]
12+
mod foo_bar;
13+
}
14+
}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn foo_decl_item(x: &mut i32) {
2+
x = 3;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
trait CoolerTypes { fn dummy(&self) {
2+
}
3+
}
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
3+
fn Foo<T>() where T: Bar {
4+
}

tests/target/issue-3253/bar.rs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Empty
2+
fn empty() {}

tests/target/issue-3253/foo.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub fn hello() {
2+
println!("Hello World!");
3+
}

tests/target/issue-3253/lib.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#[macro_use]
2+
extern crate cfg_if;
3+
4+
cfg_if! {
5+
if #[cfg(target_family = "unix")] {
6+
mod foo;
7+
#[path = "paths/bar_foo.rs"]
8+
mod bar_foo;
9+
} else {
10+
mod bar;
11+
#[path = "paths/foo_bar.rs"]
12+
mod foo_bar;
13+
}
14+
}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn foo_decl_item(x: &mut i32) {
2+
x = 3;
3+
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
3+
4+
5+
6+
fn Foo<T>() where T: Bar {
7+
}
8+
9+
10+
11+
trait CoolerTypes { fn dummy(&self) {
12+
}
13+
}
14+
15+
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn Foo<T>()
2+
where
3+
T: Bar,
4+
{
5+
}

0 commit comments

Comments
 (0)