Skip to content

Commit e262c75

Browse files
committed
test: Move style logic to libc-test source
This doesn't need to reside only within the test directory, so move it to the library to make testing simpler.
1 parent 503ece7 commit e262c75

File tree

5 files changed

+9
-14
lines changed

5 files changed

+9
-14
lines changed

libc-test/Cargo.toml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ license = "MIT OR Apache-2.0"
99
repository = "https://github.com/rust-lang/libc"
1010

1111
[dependencies]
12+
annotate-snippets = { version = "0.11.5", features = ["testing-colors"] }
1213
cfg-if = "1.0.1"
1314
libc = { path = "..", version = "1.0.0-alpha.1", default-features = false }
15+
proc-macro2 = { version = "1.0.95", features = ["span-locations"] }
16+
syn = { version = "2.0.104", features = ["full", "visit"] }
1417

1518
[dev-dependencies]
16-
syn = { version = "2.0.104", features = ["full", "visit"] }
17-
proc-macro2 = { version = "1.0.95", features = ["span-locations"] }
1819
glob = "0.3.2"
19-
annotate-snippets = { version = "0.11.5", features = ["testing-colors"] }
2020

2121
[build-dependencies]
2222
cc = "1.2.29"
@@ -98,11 +98,6 @@ name = "style"
9898
path = "test/check_style.rs"
9999
harness = true
100100

101-
[[test]]
102-
name = "style_tests"
103-
path = "test/style_tests.rs"
104-
harness = true
105-
106101
# FIXME(msrv): These should be moved to the root Cargo.toml as `[workspace.lints.*]`
107102
# once MSRV is above 1.64 and replaced with `[lints] workspace=true`
108103

libc-test/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod style;

libc-test/test/style/mod.rs renamed to libc-test/src/style.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ use syn::spanned::Spanned;
3737
use syn::visit::{self, Visit};
3838
use syn::Token;
3939

40+
#[cfg(test)]
41+
mod tests;
42+
4043
const ALLOWED_REPEATED_MACROS: &[&str] = &["s", "s_no_extra_traits", "s_paren"];
4144

4245
pub type Error = Box<dyn std::error::Error>;

libc-test/test/style_tests.rs renamed to libc-test/src/style/tests.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Verifies the implementation of the style checker in [style].
22
3-
use style::StyleChecker;
4-
5-
pub mod style;
3+
use super::StyleChecker;
64

75
#[test]
86
fn check_style_accept_correct_module_layout() {

libc-test/test/check_style.rs renamed to libc-test/test/style.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
//! cargo test --test style
1010
//! ```
1111
12-
pub mod style;
13-
1412
use std::env;
1513
use std::path::Path;
1614

17-
use style::{Result, StyleChecker};
15+
use libc_test::style::{Result, StyleChecker};
1816

1917
/// Relative to `src/`.
2018
const SKIP_PREFIXES: &[&str] = &[

0 commit comments

Comments
 (0)