mirror of
https://github.com/Noratrieb/cargo-minimize.git
synced 2026-01-14 16:35:01 +01:00
fix python indentation
This commit is contained in:
parent
45c0581fa9
commit
7fcc623c7f
3 changed files with 25 additions and 12 deletions
10
full-tests/delete-fields.rs
Normal file
10
full-tests/delete-fields.rs
Normal file
|
|
@ -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() {}
|
||||||
|
|
@ -202,6 +202,8 @@ impl Build {
|
||||||
.with_context(|| format!("spawning script: `{cmd:?}`"))?;
|
.with_context(|| format!("spawning script: `{cmd:?}`"))?;
|
||||||
|
|
||||||
let output = String::from_utf8(outputs.stderr)?;
|
let output = String::from_utf8(outputs.stderr)?;
|
||||||
|
let outputstdout = String::from_utf8(outputs.stdout)?;
|
||||||
|
println!("{outputstdout}");
|
||||||
|
|
||||||
(outputs.status.success(), outputs.status, output)
|
(outputs.status.success(), outputs.status, output)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,15 +92,16 @@ fn setup_scripts(start_roots: &[String], proj_dir: &Path) -> Result<()> {
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(", ");
|
.join(", ");
|
||||||
|
|
||||||
|
dbg!(&expected_roots);
|
||||||
|
|
||||||
write!(
|
write!(
|
||||||
BufWriter::new(&file),
|
BufWriter::new(&file),
|
||||||
r#"#!/usr/bin/env bash
|
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 "
|
python3 -c "
|
||||||
# Get the data from bash by just substituting it in. It works!
|
# Get the data from bash by just substituting it in. It works!
|
||||||
out = '$OUT'
|
out = '''$OUT'''
|
||||||
|
|
||||||
lines = out.split('\n')
|
lines = out.split('\n')
|
||||||
|
|
||||||
|
|
@ -110,15 +111,15 @@ for line in lines:
|
||||||
name = line.removeprefix('~MINIMIZE-ROOT').strip()
|
name = line.removeprefix('~MINIMIZE-ROOT').strip()
|
||||||
found.add(name)
|
found.add(name)
|
||||||
|
|
||||||
# Pass in the data _from Rust directly_. Beautiful.
|
# Pass in the data _from Rust directly_. Beautiful.
|
||||||
expected_roots = {{{expected_roots}}}
|
expected_roots = {{{expected_roots}}}
|
||||||
|
|
||||||
for root in expected_roots:
|
for root in expected_roots:
|
||||||
if root in found:
|
if root in found:
|
||||||
print(f'Found {{root}} in output')
|
print(f'Found {{root}} in output')
|
||||||
else:
|
else:
|
||||||
print(f'Did not find {{root}} in output!')
|
print(f'Did not find {{root}} in output!')
|
||||||
exit(1)
|
exit(1)
|
||||||
"
|
"
|
||||||
"#
|
"#
|
||||||
)?;
|
)?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue