-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add tests, deal with pipes, newlines, tabs for to nuon
#6391
Conversation
if val.contains('\t') { | ||
return Err(ShellError::UnsupportedInput( | ||
"tab character cannot be converted".to_string(), | ||
span, | ||
)); | ||
} | ||
quoted | ||
}), | ||
if val.contains('\n') { | ||
return Err(ShellError::UnsupportedInput( | ||
"newline character cannot be converted".to_string(), | ||
span, | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have code already to escape them to \t
and \n
respectively?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, the allowed / disallowed characters are already handled by the parser. If we want to disallow some characters in column names, let's do it in the parser. Here, we should just check for characters that break the to nuon | from nuon
roundtrip and wrap them in quotes.
I'd propose the following methodology:
The step 2. can be put into the test suite (excluding obvious working characters like 0-9, a-z or A-Z). |
66e0df5
to
52266e4
Compare
I used proptest, as suggested in the other PR. It's a dev-dependency, so that should be fine, right? |
Does it execute growing and shrinking in the CI or do you trigger the expensive operation manually? |
I would add for the particularly pathological cases Also with proptest doing strings should be fine and that will discover some other pathologies like
|
Yeah, we can also add the single-char cases @sholderbach suggested. I've never used proptest -- does it test all the characters? I don't see the logic from this PR's commits. |
@kubouch - I don't think proptest tests every character, but it does cast a rather wide net over often-problematic characters and strings. @sholderbach - I've added the cases, thanks for the suggestion! |
I also found an unrelated parser issue, #6401 |
Looking good to me. Thanks @merelymyself I was wondering if it will sample new tests during each call to CI or if it will only check the previous failures. I didn't notice a big impact on the CI times so that should probably not be an issue (as long as we don't discover random failuers over time in unrelated PR's) Other than that would be happy to land that. |
I believe it will sample new tests, but I've ran it as much as I could, so I can only hope that some new issue won't be suddenly discovered. The caught cases are already quoted - for weird cases where |
OK yeah let's land it. We can probably deal with a bit of fuzzing happening in the background ^^ |
* remove unnecessary FlatShape * add proptest * remove files that belonged in another PR * more tests, more chars * add exception for parser error unrelated ot PR
Proptest is very cool but I have noticed that these tests are much slower than others.
I imagine the slowdown is worse on slower machines like the test runners. Not sure what the best way forward is (but also it's not especially urgent). |
Yeah, running the extra iterations on proptest or quickcheck in CI doesn't seem to catch anything new. Either we restrict the iterations (at least with proptest that's configurable), ignore the tests and move the reproducibles to regular tests, or do feature crimes... (with the second approach you would have to name the test to run sampling) (what is the state on switching nextest back on?) |
Not sure. IIRC there were 2 main issues with nextest in CI:
We could probably turn it on again, but the cost-benefit analysis is kinda ¯\_(ツ)_/¯ |
Description
Related: #6379
Tests
Make sure you've done the following:
Make sure you've run and fixed any issues with these commands:
cargo fmt --all -- --check
to check standard code formatting (cargo fmt --all
applies these changes)cargo clippy --workspace --features=extra -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect
to check that you're using the standard code stylecargo test --workspace --features=extra
to check that all the tests pass