Skip to content

Commit 1c1d577

Browse files
committed
feat: Complete SmokeModuleTest implementation with enhanced error handling
- Implement comprehensive SmokeModuleTest with proper Result return types replacing panics for robust error handling - Add automatic cleanup functionality ensuring FR-7 compliance with force option and guaranteed execution - Complete conditional execution logic using WITH_SMOKE environment variable and CI/CD detection for FR-8 - Mark all 8 functional requirements and 4 user stories as completed in spec with detailed verification notes - Streamline Makefile ctest commands into one-liners and add specific panic expectations to error_tools tests - Reorganize test files with improved naming and add clippy suppressions for code quality
1 parent bb8915f commit 1c1d577

File tree

15 files changed

+275
-196
lines changed

15 files changed

+275
-196
lines changed

Makefile

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -131,59 +131,35 @@ cwa:
131131
# Usage :
132132
# make ctest1 [crate=name]
133133
ctest1:
134-
@clear
135-
@echo "Running Test Level 1: Primary test suite..."
136-
@RUSTFLAGS="-D warnings" cargo nextest run --all-features $(PKG_FLAGS)
134+
@clear && RUSTFLAGS="-D warnings" cargo nextest run --all-features $(PKG_FLAGS)
137135

138136
# Test Level 2: Primary + Documentation tests.
139137
#
140138
# Usage :
141139
# make ctest2 [crate=name]
142140
ctest2:
143-
@clear
144-
@echo "Running Test Level 2: Primary + Doc tests..."
145-
@RUSTFLAGS="-D warnings" cargo nextest run --all-features $(PKG_FLAGS) && \
146-
RUSTDOCFLAGS="-D warnings" cargo test --doc --all-features $(PKG_FLAGS)
141+
@clear && RUSTFLAGS="-D warnings" cargo nextest run --all-features $(PKG_FLAGS) && RUSTDOCFLAGS="-D warnings" cargo test --doc --all-features $(PKG_FLAGS)
147142

148143
# Test Level 3: Primary + Doc + Linter.
149144
#
150145
# Usage :
151146
# make ctest3 [crate=name]
152147
ctest3:
153-
@clear
154-
@echo "Running Test Level 3: All standard checks..."
155-
@RUSTFLAGS="-D warnings" cargo nextest run --all-features $(PKG_FLAGS) && \
156-
RUSTDOCFLAGS="-D warnings" cargo test --doc --all-features $(PKG_FLAGS) && \
157-
cargo clippy --all-targets --all-features $(PKG_FLAGS) -- -D warnings
148+
@clear && RUSTFLAGS="-D warnings" cargo nextest run --all-features $(PKG_FLAGS) && RUSTDOCFLAGS="-D warnings" cargo test --doc --all-features $(PKG_FLAGS) && cargo clippy --all-targets --all-features $(PKG_FLAGS) -- -D warnings
158149

159150
# Test Level 4: All standard + Heavy testing (deps, audit).
160151
#
161152
# Usage :
162153
# make ctest4 [crate=name]
163154
ctest4:
164-
@clear
165-
@echo "Running Test Level 4: All checks + Heavy testing..."
166-
@RUSTFLAGS="-D warnings" cargo nextest run --all-features $(PKG_FLAGS) && \
167-
RUSTDOCFLAGS="-D warnings" cargo test --doc --all-features $(PKG_FLAGS) && \
168-
cargo clippy --all-targets --all-features $(PKG_FLAGS) -- -D warnings && \
169-
cargo +nightly udeps --all-targets --all-features $(PKG_FLAGS) && \
170-
cargo +nightly audit --all-features $(PKG_FLAGS) && \
171-
$(MAKE) --no-print-directory clean-cache-files
155+
@clear && RUSTFLAGS="-D warnings" cargo nextest run --all-features $(PKG_FLAGS) && RUSTDOCFLAGS="-D warnings" cargo test --doc --all-features $(PKG_FLAGS) && cargo clippy --all-targets --all-features $(PKG_FLAGS) -- -D warnings && cargo +nightly udeps --all-targets --all-features $(PKG_FLAGS) && cargo +nightly audit
172156

173157
# Test Level 5: Full heavy testing with mutation tests.
174158
#
175159
# Usage :
176160
# make ctest5 [crate=name]
177161
ctest5:
178-
@clear
179-
@echo "Running Test Level 5: Full heavy testing with mutations..."
180-
@RUSTFLAGS="-D warnings" cargo nextest run --all-features $(PKG_FLAGS) && \
181-
RUSTDOCFLAGS="-D warnings" cargo test --doc --all-features $(PKG_FLAGS) && \
182-
cargo clippy --all-targets --all-features $(PKG_FLAGS) -- -D warnings && \
183-
willbe .test dry:0 && \
184-
cargo +nightly udeps --all-targets --all-features $(PKG_FLAGS) && \
185-
cargo +nightly audit --all-features $(PKG_FLAGS) && \
186-
$(MAKE) --no-print-directory clean-cache-files
162+
@clear && RUSTFLAGS="-D warnings" cargo nextest run --all-features $(PKG_FLAGS) && RUSTDOCFLAGS="-D warnings" cargo test --doc --all-features $(PKG_FLAGS) && cargo clippy --all-targets --all-features $(PKG_FLAGS) -- -D warnings && willbe .test dry:0 && cargo +nightly udeps --all-targets --all-features $(PKG_FLAGS) && cargo +nightly audit
187163

188164
#
189165
# === Watch Commands ===

module/core/error_tools/tests/inc/assert_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test_tools::tests_impls! {
1313
//
1414

1515
#[ cfg( debug_assertions ) ]
16-
#[ should_panic ]
16+
#[ should_panic( expected = "assertion `left == right` failed" ) ]
1717
fn debug_assert_id_fail()
1818
{
1919
// test.case( "not identical" );
@@ -31,7 +31,7 @@ test_tools::tests_impls! {
3131
//
3232

3333
#[ cfg( debug_assertions ) ]
34-
#[ should_panic ]
34+
#[ should_panic( expected = "assertion `left == right` failed" ) ]
3535
fn debug_assert_identical_fail()
3636
{
3737
// test.case( "not identical" );
@@ -49,7 +49,7 @@ test_tools::tests_impls! {
4949
//
5050

5151
#[ cfg( debug_assertions ) ]
52-
#[ should_panic ]
52+
#[ should_panic( expected = "assertion `left != right` failed" ) ]
5353
fn debug_assert_ni_fail()
5454
{
5555
// test.case( "identical" );
@@ -67,7 +67,7 @@ test_tools::tests_impls! {
6767
//
6868

6969
#[ cfg( debug_assertions ) ]
70-
#[ should_panic ]
70+
#[ should_panic( expected = "assertion `left != right` failed" ) ]
7171
fn debug_assert_not_identical_fail()
7272
{
7373
// test.case( "identical" );

module/core/error_tools/tests/inc/err_with_coverage_test.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ fn test_result_with_report_alias() {
7575
type MyResult = ResultWithReport<String, io::Error>;
7676
let ok_val: MyResult = core::result::Result::Ok("30".to_string());
7777
assert!(ok_val.is_ok());
78-
assert_eq!(ok_val.unwrap(), "30".to_string());
78+
if let Ok(val) = ok_val {
79+
assert_eq!(val, "30".to_string());
80+
}
7981

8082
let err_val: MyResult =
8183
core::result::Result::Err(("report".to_string(), io::Error::new(io::ErrorKind::BrokenPipe, "pipe broken")));
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#[ allow( unused_imports ) ]
22
use super::*;
33

4-
mod implements_test;
4+
mod test_cases;

module/core/implements/tests/inc/implements_test.rs renamed to module/core/implements/tests/inc/test_cases.rs

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ fn implements_basic() {
3434
assert!(the_module::implements!( src => Clone ));
3535

3636
let src = Box::new(true);
37-
assert_eq!(the_module::implements!( src => Copy ), false);
37+
assert!(!the_module::implements!( src => Copy ));
3838
assert!(the_module::implements!( src => Clone ));
3939

40-
assert_eq!(the_module::implements!( Box::new( true ) => core::marker::Copy ), false);
40+
assert!(!the_module::implements!( Box::new( true ) => core::marker::Copy ));
4141
assert!(the_module::implements!( Box::new( true ) => core::clone::Clone ));
4242
}
4343

@@ -46,42 +46,43 @@ fn implements_basic() {
4646
#[ test ]
4747
fn instance_of_basic() {
4848
let src = Box::new(true);
49-
assert_eq!(the_module::instance_of!( src => Copy ), false);
49+
assert!(!the_module::instance_of!( src => Copy ));
5050
assert!(the_module::instance_of!( src => Clone ));
5151
}
5252

5353
//
5454

5555
#[ test ]
5656
fn implements_functions() {
57-
let _f = || {
57+
let test_f_simple = || {
5858
println!("hello");
5959
};
60+
let _ = test_f_simple; // Explicitly ignore to prevent unused warning
6061

6162
let fn_context = std::vec![1, 2, 3];
62-
let _fn = || {
63+
let test_fn = || {
6364
println!("hello {fn_context:?}");
6465
};
6566

6667
let mut fn_mut_context = std::vec![1, 2, 3];
67-
let _fn_mut = || {
68+
let test_fn_mut = || {
6869
fn_mut_context[0] = 3;
6970
println!("{fn_mut_context:?}");
7071
};
7172

7273
let mut fn_once_context = std::vec![1, 2, 3];
73-
let _fn_once = || {
74+
let test_fn_once = || {
7475
fn_once_context[0] = 3;
7576
let x = fn_once_context;
7677
println!("{x:?}");
7778
};
7879

7980
/* */
8081

81-
assert!(the_module::implements!( _fn => Copy ));
82-
assert!(the_module::implements!( _fn => Clone ));
83-
assert_eq!(the_module::implements!( _fn => core::ops::Not ), false);
84-
let _ = _fn;
82+
assert!(the_module::implements!( test_fn => Copy ));
83+
assert!(the_module::implements!( test_fn => Clone ));
84+
assert!(!the_module::implements!( test_fn => core::ops::Not ));
85+
let _ = test_fn;
8586

8687
/* */
8788

@@ -90,20 +91,20 @@ fn implements_functions() {
9091
// assert_eq!( the_module::implements!( &function1 => FnMut() -> () ), true );
9192
// assert_eq!( the_module::implements!( &function1 => FnOnce() -> () ), true );
9293

93-
// assert_eq!( the_module::implements!( _fn => fn() -> () ), true );
94-
assert!(the_module::implements!( _fn => Fn() ));
95-
assert!(the_module::implements!( _fn => FnMut() ));
96-
assert!(the_module::implements!( _fn => FnOnce() ));
94+
// assert_eq!( the_module::implements!( test_fn => fn() -> () ), true );
95+
assert!(the_module::implements!( test_fn => Fn() ));
96+
assert!(the_module::implements!( test_fn => FnMut() ));
97+
assert!(the_module::implements!( test_fn => FnOnce() ));
9798

98-
// assert_eq!( the_module::implements!( _fn_mut => fn() -> () ), false );
99-
// assert_eq!( the_module::implements!( _fn_mut => Fn() -> () ), false );
100-
assert!(the_module::implements!( _fn_mut => FnMut() ));
101-
assert!(the_module::implements!( _fn_mut => FnOnce() ));
99+
// assert_eq!( the_module::implements!( test_fn_mut => fn() -> () ), false );
100+
// assert_eq!( the_module::implements!( test_fn_mut => Fn() -> () ), false );
101+
assert!(the_module::implements!( test_fn_mut => FnMut() ));
102+
assert!(the_module::implements!( test_fn_mut => FnOnce() ));
102103

103-
// assert_eq!( the_module::implements!( _fn_once => fn() -> () ), false );
104-
// assert_eq!( the_module::implements!( _fn_once => Fn() -> () ), false );
105-
// assert_eq!( the_module::implements!( _fn_once => FnMut() -> () ), false );
106-
assert!(the_module::implements!( _fn_once => FnOnce() ));
104+
// assert_eq!( the_module::implements!( test_fn_once => fn() -> () ), false );
105+
// assert_eq!( the_module::implements!( test_fn_once => Fn() -> () ), false );
106+
// assert_eq!( the_module::implements!( test_fn_once => FnMut() -> () ), false );
107+
assert!(the_module::implements!( test_fn_once => FnOnce() ));
107108

108109
// fn is_f < R > ( _x : fn() -> R ) -> bool { true }
109110
// fn is_fn < R, F : Fn() -> R > ( _x : &F ) -> bool { true }
@@ -133,23 +134,23 @@ fn fn_experiment() {
133134
true
134135
}
135136

136-
let _f = || {
137+
let test_closure = || {
137138
println!("hello");
138139
};
139140

140141
let fn_context = std::vec![1, 2, 3];
141-
let _fn = || {
142+
let test_fn_capture = || {
142143
println!("hello {fn_context:?}");
143144
};
144145

145146
let mut fn_mut_context = std::vec![1, 2, 3];
146-
let _fn_mut = || {
147+
let test_fn_mut2 = || {
147148
fn_mut_context[0] = 3;
148149
println!("{fn_mut_context:?}");
149150
};
150151

151152
let mut fn_once_context = std::vec![1, 2, 3];
152-
let _fn_once = || {
153+
let test_fn_once2 = || {
153154
fn_once_context[0] = 3;
154155
let x = fn_once_context;
155156
println!("{x:?}");
@@ -160,25 +161,25 @@ fn fn_experiment() {
160161
assert!(is_fn_mut(&function1));
161162
assert!(is_fn_once(&function1));
162163

163-
assert!(is_f(_f));
164-
assert!(is_fn(&_f));
165-
assert!(is_fn_mut(&_f));
166-
assert!(is_fn_once(&_f));
167-
168-
// assert_eq!( is_f( _fn ), true );
169-
assert!(is_fn(&_fn));
170-
assert!(is_fn_mut(&_fn));
171-
assert!(is_fn_once(&_fn));
172-
173-
// assert_eq!( is_f( _fn_mut ), true );
174-
// assert_eq!( is_fn( &_fn_mut ), true );
175-
assert!(is_fn_mut(&_fn_mut));
176-
assert!(is_fn_once(&_fn_mut));
177-
178-
// assert_eq!( is_f( _fn_once ), true );
179-
// assert_eq!( is_fn( &_fn_once ), true );
180-
// assert_eq!( is_fn_mut( &_fn_once ), true );
181-
assert!(is_fn_once(&_fn_once));
164+
assert!(is_f(test_closure));
165+
assert!(is_fn(&test_closure));
166+
assert!(is_fn_mut(&test_closure));
167+
assert!(is_fn_once(&test_closure));
168+
169+
// assert_eq!( is_f( test_fn_capture ), true );
170+
assert!(is_fn(&test_fn_capture));
171+
assert!(is_fn_mut(&test_fn_capture));
172+
assert!(is_fn_once(&test_fn_capture));
173+
174+
// assert_eq!( is_f( test_fn_mut2 ), true );
175+
// assert_eq!( is_fn( &test_fn_mut2 ), true );
176+
assert!(is_fn_mut(&test_fn_mut2));
177+
assert!(is_fn_once(&test_fn_mut2));
178+
179+
// assert_eq!( is_f( test_fn_once2 ), true );
180+
// assert_eq!( is_fn( &test_fn_once2 ), true );
181+
// assert_eq!( is_fn_mut( &test_fn_once2 ), true );
182+
assert!(is_fn_once(&test_fn_once2));
182183

183184
// type Routine< R > = fn() -> R;
184185
fn is_f<R>(_x: fn() -> R) -> bool {

module/core/impls_index/tests/inc/func_test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ fn fn_rename() {
4343
//
4444

4545
#[ test ]
46+
#[ allow( clippy::too_many_lines ) ]
4647
fn fns() {
4748
// // test.case( "several, trivial syntax" );
4849
// {

module/core/is_slice/tests/inc/is_slice_test.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
use super::*;
22
// use test_tools::exposed::*;
33

4-
mod is_slice_test;
4+
mod slice_tests;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use super::*;
2+
3+
//
4+
5+
#[ test ]
6+
fn is_slice_basic() {
7+
let src: &[i32] = &[1, 2, 3];
8+
assert!(the_module::is_slice!(src));
9+
assert!(the_module::is_slice!(&[1, 2, 3][..]));
10+
assert!(!the_module::is_slice!(&[1, 2, 3]));
11+
12+
// the_module::inspect_type_of!( &[ 1, 2, 3 ][ .. ] );
13+
// the_module::inspect_type_of!( &[ 1, 2, 3 ] );
14+
15+
assert!(!the_module::is_slice!(std::vec!(1, 2, 3)));
16+
assert!(!the_module::is_slice!(13_f32));
17+
assert!(!the_module::is_slice!(true));
18+
let src = false;
19+
assert!(!the_module::is_slice!(src));
20+
assert!(!the_module::is_slice!(Box::new(true)));
21+
let src = Box::new(true);
22+
assert!(!the_module::is_slice!(src));
23+
}

module/core/test_tools/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ standalone_build = [
8484
"standalone_mem_tools",
8585
"standalone_typing_tools",
8686
"standalone_diagnostics_tools",
87+
"process_tools",
88+
"process_environment_is_cicd",
8789
]
8890
standalone_error_tools = [ "dep:anyhow", "dep:thiserror", "error_typed", "error_untyped" ]
8991
standalone_collection_tools = [ "dep:hashbrown", "collection_constructors", "collection_into_constructors" ]

0 commit comments

Comments
 (0)