Closed waynr closed 2 months ago
Okay I've figured out that if I filter for a specific test case, it will output the actual vs expected in a helpful manner:
zsh/5 13154 [101] (git)-[upgrade-dep/pulldown-cmark]-% cargo test specs::Issues::Issue0018
Finished test [unoptimized + debuginfo] target(s) in 0.03s
Running unittests src/lib.rs (target/debug/deps/dprint_plugin_markdown-2102e1c6bdb97ef3)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 11 filtered out; finished in 0.00s
Running tests/newline_test.rs (target/debug/deps/newline_test-ba542eeabbda887f)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out; finished in 0.00s
Running tests/spec_test.rs (target/debug/deps/specs-e5bd8a13f89a1de6)
Running specs::Issues
test specs::Issues::Issue0018 ... (4ms)
should format as-is fail
spec failures:
---- specs::Issues::Issue0018 ----
Failed: should format as-is (./tests/specs/Issues/Issue0018.txt)
Expected: `"- [ ] a\n- [ ] b\n\n- [ ] c\n- [ ] d\n"`,
Actual: `"- [ ]a\n- [ ]b\n\n- [ ]c\n- [ ]d\n"`,`,
Diff:
-- [ ] a
-- [ ] b
+- [ ]a
+- [ ]b
-- [ ] c
-- [ ] d
+- [ ]c
+- [ ]d
Test file: ./tests/specs/Issues/Issue0018.txt
failures:
specs::Issues::Issue0018
thread 'main' panicked at /home/wayne/.cargo/registry/src/index.crates.io-6f17d22bba15001f/file_test_runner-0.5.0/src/runner.rs:176:5
For the specific test case I highlighted in my last comment it almost looks like the pulldown-cmark
crate changed the way it tokenizes list items, ie they no longer include in the initial space between the list item symbol and the content of the list as part of the content :thinking:
If that's the case, then code that generates the formatted output would need to insert a new space, right?
I'm going to close this issue since I figured out my original problem and it doesn't seem likely worth the effort for this project to make significant changes to the test runner for my sake. I've since learned to deal with the test runner's idiosyncrasies.
For what it's worth, the original problem:
Debug panic! Found a newline in the string. Before sending the string to the printer it needs to be broken up and the newline sent as a PrintItem::NewLine. <details>
...resulted from a change I naively made to gen_html
that resulted in capturing a newline in a PrintItem
.
Describe the bug
dprint-plugin-markdown version: main branch
I'm currently attempting to work through tests broken by my local copy of the PR branch in https://github.com/dprint/dprint-plugin-markdown/pull/108. I've got several local commits on top of what I've pushed to that branch so far, so I am making progress. However, I am currently encountering tests broken by my changes that either don't report anything or seem to simply hang indefinitely.
example: test fails with no explanation
Granted these to print what appear to be test headings alongside the
fail
indicator, but what's missing for these tests is some kind of "here is the expect output: {expected}\nhere is the actual output: {actual}" message.example: test helper function seems to panic
The test suite as a whole gets stuck waiting for
test specs::Lists::Lists_All
even though thefile_test_runner
mechanisms couldn't possibly detect that it finishes.I think this points to a problem with panic recovery in the test runner. Do newer versions of
file_test_runner
properly recover its threads from panics?I realize that the tests work fine on main branch and are only failing this way on my branch so there is something I am ultimately doing wrong here. But normally when writing rust code with panics coming from
todo!()
orunimplemented!()
the built-in test runner itself recovers gracefully enough to print relevant error messages.