Skip to content

Commit

Permalink
skip style checker implementation tests in ci as well
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehri01 committed Jan 10, 2025
1 parent 2c11788 commit b73c617
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ci/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ -n "${CI:-}" ]; then
check="--check"
fi

cargo test --manifest-path libc-test/Cargo.toml --test style -- --nocapture
cargo test --manifest-path libc-test/Cargo.toml --test style --test style_tests -- --nocapture

command -v rustfmt
rustfmt -V
Expand Down
2 changes: 1 addition & 1 deletion libc-test/test/check_style.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Simple script to verify the coding style of this library
//! Simple script to verify the coding style of this library.
//!
//! ## How to run
//!
Expand Down
34 changes: 17 additions & 17 deletions libc-test/test/style_tests.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! Verifies the implementation of the style checker in [style]
//! Verifies the implementation of the style checker in [style].
use style::StyleChecker;

pub mod style;

#[test]
fn accept_correct_module_layout() {
fn check_style_accept_correct_module_layout() {
let contents = r#"
use core::mem::size_of;
pub type foo_t = u32;
Expand All @@ -24,7 +24,7 @@ pub use self::foolib::*;
}

#[test]
fn reject_incorrect_module_layout() {
fn check_style_reject_incorrect_module_layout() {
let contents = r#"
use core::mem::size_of;
pub type foo_t = u32;
Expand All @@ -43,7 +43,7 @@ pub use self::foolib::*;
}

#[test]
fn reject_incorrect_cfg_if_layout() {
fn check_style_reject_incorrect_cfg_if_layout() {
let contents = r#"
cfg_if! {
if #[cfg(foo)] {
Expand All @@ -60,7 +60,7 @@ cfg_if! {
}

#[test]
fn accept_cfg_if_branch_resets_state() {
fn check_style_accept_cfg_if_branch_resets_state() {
let contents = r#"
cfg_if! {
if #[cfg(foo)] {
Expand All @@ -79,7 +79,7 @@ cfg_if! {
}

#[test]
fn reject_multiple_f_macros() {
fn check_style_reject_multiple_f_macros() {
let contents = r#"
f! {}
f! {}
Expand All @@ -92,7 +92,7 @@ f! {}
}

#[test]
fn cfg_ignore_target_endian_nested() {
fn check_style_accept_cfg_ignore_target_endian_nested() {
let contents = r#"
pub struct Foo {
#[cfg(target_endian = "little")]
Expand All @@ -107,7 +107,7 @@ pub struct Foo {
}

#[test]
fn reject_manual_copy() {
fn check_style_reject_manual_copy() {
let contents = r#"
#[derive(Copy)]
pub struct Foo {}
Expand All @@ -120,7 +120,7 @@ pub struct Foo {}
}

#[test]
fn reject_manual_clone() {
fn check_style_reject_manual_clone() {
let contents = r#"
#[derive(Clone)]
pub struct Foo {}
Expand All @@ -133,7 +133,7 @@ pub struct Foo {}
}

#[test]
fn accept_multiple_s_macros_with_disjoint_cfg() {
fn check_style_accept_multiple_s_macros_with_disjoint_cfg() {
let contents = r#"
// Main `s!`
s! {}
Expand All @@ -155,7 +155,7 @@ s! { pub struct bar { /* ... */ } }
}

#[test]
fn reject_duplicated_s_macro() {
fn check_style_reject_duplicated_s_macro() {
let contents = r#"
s! {}
s! {}
Expand All @@ -168,7 +168,7 @@ s! {}
}

#[test]
fn reject_duplicated_s_macro_cfg() {
fn check_style_reject_duplicated_s_macro_cfg() {
let contents = r#"
#[cfg(not(target_arch = "foo"))]
s! {}
Expand All @@ -184,7 +184,7 @@ s! {}
}

#[test]
fn reject_single_positive_s_macro_cfg() {
fn check_style_reject_single_positive_s_macro_cfg() {
let contents = r#"
// A positive (no `not`) config: reject because this should go into
// the relevant file.
Expand All @@ -199,7 +199,7 @@ s! { pub struct foo { /* ... */ } }
}

#[test]
fn reject_single_positive_s_macro_cfg_target_os() {
fn check_style_reject_single_positive_s_macro_cfg_target_os() {
let contents = r#"
// A positive (no `not`) config: reject because this should go into
// the relevant file.
Expand All @@ -214,7 +214,7 @@ s! { pub struct foo { /* ... */ } }
}

#[test]
fn accept_positive_s_macro_any() {
fn check_style_accept_positive_s_macro_any() {
let contents = r#"
// It's nicer to accept this so that we don't have to duplicate the same struct 3 times.
#[cfg(any(target_arch = "foo", target_arch = "bar", target_arch = "baz"))]
Expand All @@ -228,7 +228,7 @@ s! { pub struct foo { /* ... */ } }
}

#[test]
fn accept_positive_s_macro_all() {
fn check_style_accept_positive_s_macro_all() {
let contents = r#"
#[cfg(all(target_arch = "foo", target_arch = "bar", target_arch = "baz"))]
s! { pub struct foo { /* ... */ } }
Expand All @@ -241,7 +241,7 @@ s! { pub struct foo { /* ... */ } }
}

#[test]
fn reject_duplicated_cfg_and_cfg_if() {
fn check_style_reject_duplicated_cfg_and_cfg_if() {
let contents = r#"
#[cfg(not(target_arch = "foo"))]
s! { pub struct foo { /* ... */ } }
Expand Down

0 comments on commit b73c617

Please sign in to comment.