Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Csplit: first implementation #75

Merged
merged 10 commits into from
Apr 29, 2024
Merged

Csplit: first implementation #75

merged 10 commits into from
Apr 29, 2024

Conversation

Wandalen
Copy link
Contributor

Please review @jgarzik

@jgarzik
Copy link
Contributor

jgarzik commented Apr 25, 2024

overall looks good - please add a test for regex + negative offset

@jgarzik
Copy link
Contributor

jgarzik commented Apr 26, 2024

Ok, it looks good from visual inspection. Two problems appear in my testing:

  1. When merging with current main branch, it does not build. This is a simple fix:
  • pull current tree into branch
  • a patch like
--- a/text/tests/integration.rs
+++ b/text/tests/integration.rs
@@ -58,6 +58,8 @@ fn csplit_test(args: &[&str], test_data: &str, expected_output: &str) {
         args: str_args,
         stdin_data: String::from(test_data),
         expected_out: String::from(expected_output),
+        expected_err: String::from(""),
+        expected_exit_code: 0,
     });
 }
 
  1. the tests fail on MacOS:

     Running unittests src/csplit.rs (target/debug/deps/csplit-ce747118c68cdf4d)

running 16 tests
test tests::test_escaped_end_pos ... ok
test tests::test_parse_op_linenum_valid ... ok
test tests::test_incr_suffix ... ok
test tests::test_parse_op_linenum_invalid_non_numeric ... ok
test tests::test_parse_op_rx_invalid ... ok
test tests::test_parse_op_rx_valid_with_positive_offset ... ok
test tests::test_parse_op_rx_valid_with_leading_plus ... ok
test tests::test_parse_op_rx_valid_without_offset ... ok
test tests::test_parse_op_rx_valid_with_skip_mode ... ok
test tests::test_parse_op_rx_valid_with_negative_offset ... ok
test tests::test_parse_op_repeat_invalid_missing_braces ... ok
test tests::test_parse_op_repeat_valid ... ok
test tests::test_parse_op_repeat_invalid_non_numeric ... ok
test tests::test_parse_operands ... ok
test tests::test_split_text_file ... FAILED
test tests::test_split_c_file_2 ... FAILED

failures:

---- tests::test_split_text_file stdout ----
56

70

14

5

thread 'tests::test_split_text_file' panicked at text/src/csplit.rs:847:9:
assertion `left == right` failed
  left: "int main() {\n    printf(\"Hello, world!\\n\");\n    return 0;\n}\n"
 right: "1sdfghnm\n2sadsgdhjmf\n3zcxbncvm vbm\n4asdbncv\n5adsbfdgfnfm\n"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- tests::test_split_c_file_2 stdout ----
60

53

53

53

thread 'tests::test_split_c_file_2' panicked at text/src/csplit.rs:903:9:
assertion `left == right` failed
  left: "int main() {\n    printf(\"Hello, world!\\n\");\n    return 0;\n}\n"
 right: "int main() {\n    printf(\"Hello, world!\\n\");\n    return 0;\n}\n\n"


failures:
    tests::test_split_c_file_2
    tests::test_split_text_file

test result: FAILED. 14 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

error: test failed, to rerun pass `-p posixutils-text --bin csplit`

Please update for these issues, and I will re-test.

Denys Levchenko and others added 2 commits April 28, 2024 20:24
@jgarzik jgarzik merged commit 85bea14 into rustcoreutils:main Apr 29, 2024
@jgarzik
Copy link
Contributor

jgarzik commented Apr 29, 2024

Merged

@jgarzik jgarzik added the enhancement New feature or request label Apr 29, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants