diff --git a/full-tests/delete-fields.rs b/full-tests/delete-fields.rs new file mode 100644 index 0000000..2d3db23 --- /dev/null +++ b/full-tests/delete-fields.rs @@ -0,0 +1,10 @@ +/// ~MINIMIZE-ROOT HasFields +struct HasFields { + /// ~REQUIRE-DELETED field_a + field_a: (), + /// ~MINIMIZE-ROOT field_b + field_b: (), +} + +/// ~MINIMIZE-ROOT main +fn main() {} diff --git a/src/build.rs b/src/build.rs index 97f01f3..d9fc9fe 100644 --- a/src/build.rs +++ b/src/build.rs @@ -202,6 +202,8 @@ impl Build { .with_context(|| format!("spawning script: `{cmd:?}`"))?; let output = String::from_utf8(outputs.stderr)?; + let outputstdout = String::from_utf8(outputs.stdout)?; + println!("{outputstdout}"); (outputs.status.success(), outputs.status, output) } diff --git a/tests/full_tests.rs b/tests/full_tests.rs index ca97eaf..0cb4a2f 100644 --- a/tests/full_tests.rs +++ b/tests/full_tests.rs @@ -92,15 +92,16 @@ fn setup_scripts(start_roots: &[String], proj_dir: &Path) -> Result<()> { .collect::>() .join(", "); + dbg!(&expected_roots); + write!( BufWriter::new(&file), r#"#!/usr/bin/env bash +OUT=$(rg -o "~MINIMIZE-ROOT [\w\-]*" --no-filename --sort path src) -OUT=$(rg -o "~MINIMIZE-ROOT [\w\-]*" full-tests/ --no-filename --sort path src) - python3 -c " # Get the data from bash by just substituting it in. It works! -out = '$OUT' +out = '''$OUT''' lines = out.split('\n') @@ -110,15 +111,15 @@ for line in lines: name = line.removeprefix('~MINIMIZE-ROOT').strip() found.add(name) - # Pass in the data _from Rust directly_. Beautiful. - expected_roots = {{{expected_roots}}} - - for root in expected_roots: - if root in found: - print(f'Found {{root}} in output') - else: - print(f'Did not find {{root}} in output!') - exit(1) +# Pass in the data _from Rust directly_. Beautiful. +expected_roots = {{{expected_roots}}} + +for root in expected_roots: + if root in found: + print(f'Found {{root}} in output') + else: + print(f'Did not find {{root}} in output!') + exit(1) " "# )?;