diff --git a/README.md b/README.md index f947f09..ea2eacc 100644 --- a/README.md +++ b/README.md @@ -115,11 +115,9 @@ When running the detectors we can generate test cases for each path in the funct ``` -cargo run -- -f ./examples/sierra/fib_array.sierra -d - -[...] +cargo run -- -f ./examples/sierra/symbolic_execution_test.sierra -d --detector-names tests -[Informational] Tests generator +[Testing] Tests generator - symbolic::symbolic::symbolic_execution_test : - v0: 102, v1: 0, v2: 0, v3: 0 - v0: 103, v1: 0, v2: 0, v3: 0 diff --git a/bin/sierra-decompiler/src/main.rs b/bin/sierra-decompiler/src/main.rs index 64c1209..981351e 100644 --- a/bin/sierra-decompiler/src/main.rs +++ b/bin/sierra-decompiler/src/main.rs @@ -234,10 +234,13 @@ fn handle_detectors(decompiler: &mut Decompiler, detector_names: Vec) { // Run the specified detectors for detector in detectors.iter_mut() { - // Skip TESTING detectors and detectors not in the provided names - if detector.detector_type() == DetectorType::TESTING - || !detector_names.is_empty() && !detector_names.contains(&detector.id().to_string()) - { + // Skip TESTING detectors if no specific detector names are provided + if detector_names.is_empty() && detector.detector_type() == DetectorType::TESTING { + continue; + } + + // Skip detectors not in the provided names if names are provided + if !detector_names.is_empty() && !detector_names.contains(&detector.id().to_string()) { continue; } diff --git a/lib/src/detectors/functions_detector.rs b/lib/src/detectors/functions_detector.rs index 9c71195..33e54a7 100644 --- a/lib/src/detectors/functions_detector.rs +++ b/lib/src/detectors/functions_detector.rs @@ -54,6 +54,9 @@ impl Detector for FunctionsDetector { if index < total_functions - 1 { result += "\n"; } + + // Append the ANSI reset sequence + result += &"\x1b[0m".to_string(); } } result diff --git a/lib/tests/detectors.rs b/lib/tests/detectors.rs index 8fcaeb0..66bba0e 100644 --- a/lib/tests/detectors.rs +++ b/lib/tests/detectors.rs @@ -54,8 +54,8 @@ fn test_functions_detector() { // functions names let functions_names = detector.detect(&mut decompiler); - let expected_output = r#"examples::fib_array::fib -examples::fib_array::fib_inner"#; + let expected_output = + "examples::fib_array::fib\n\u{1b}[0mexamples::fib_array::fib_inner\u{1b}[0m"; assert_eq!(functions_names, expected_output); }