Skip to content

Commit 412bfcc

Browse files
committed
Add tests
1 parent 2c91877 commit 412bfcc

File tree

13 files changed

+57
-0
lines changed

13 files changed

+57
-0
lines changed

src/test/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ const SKIP_FILE_WHITE_LIST: &[&str] = &[
2828
// These files and directory are a part of modules defined inside `cfg_if!`.
2929
"cfg_if/mod.rs",
3030
"cfg_if/detect",
31+
// These files and directory are a part of modules defined inside `cfg_attr(..)`.
32+
"cfg_mod/dir",
33+
"cfg_mod/bar.rs",
34+
"cfg_mod/foo.rs",
35+
"cfg_mod/wasm32.rs",
3136
];
3237

3338
struct TestSetting {

tests/source/cfg_mod/bar.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn bar( ) -> &str {
2+
"bar"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn
2+
wasm32
3+
() -> &str
4+
{
5+
"wasm32"
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn
2+
wasm32
3+
() -> &str
4+
{
5+
"wasm32"
6+
}

tests/source/cfg_mod/foo.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fn foo( )
2+
-> &str {
3+
"foo"
4+
}

tests/source/cfg_mod/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#[cfg_attr(feature = "foo", path = "foo.rs")]
2+
#[cfg_attr(not(feture = "foo"), path = "bar.rs")]
3+
mod sub_mod;
4+
5+
#[cfg_attr(target_arch = "wasm32", path = "dir/dir1/dir2/wasm32.rs")]
6+
#[cfg_attr(not(target_arch = "wasm32"), path = "dir/dir1/dir3/wasm32.rs")]
7+
mod wasm32;

tests/source/cfg_mod/wasm32.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fn
2+
wasm32() -> &str {
3+
"wasm32"
4+
}

tests/target/cfg_mod/bar.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn bar() -> &str {
2+
"bar"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn wasm32() -> &str {
2+
"wasm32"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn wasm32() -> &str {
2+
"wasm32"
3+
}

tests/target/cfg_mod/foo.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn foo() -> &str {
2+
"foo"
3+
}

tests/target/cfg_mod/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#[cfg_attr(feature = "foo", path = "foo.rs")]
2+
#[cfg_attr(not(feture = "foo"), path = "bar.rs")]
3+
mod sub_mod;
4+
5+
#[cfg_attr(target_arch = "wasm32", path = "dir/dir1/dir2/wasm32.rs")]
6+
#[cfg_attr(not(target_arch = "wasm32"), path = "dir/dir1/dir3/wasm32.rs")]
7+
mod wasm32;

tests/target/cfg_mod/wasm32.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn wasm32() -> &str {
2+
"wasm32"
3+
}

0 commit comments

Comments
 (0)