AlecAivazis / survey

A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
MIT License
4.07k stars 351 forks source link

fix(input.go): delete answer after validate failure #351

Closed zitn closed 3 years ago

zitn commented 3 years ago

Closes #350

AlecAivazis commented 3 years ago

@zigitn - i fixed the issue preventing the CI pipeline from executing. Mind rebasing onto master so we can get this in?

zitn commented 3 years ago

Of course, do I need to submit a new pr?

AlecAivazis commented 3 years ago

You should be able to get away with just force-pushing over your existing branch

AlecAivazis commented 3 years ago

Thanks for doing that @zigitn! Do you mind adding a test that verifies this behavior?

cben commented 3 years ago

@AlecAivazis I didn't find existing tests for WithValidator that actually test the input.go logic. Do you have advice how/where to test this?

AlecAivazis commented 3 years ago

@cben - thanks for picking this up. I think the Ask tests are a good example to copy

cben commented 3 years ago

Turns out the whole TestAsk test has been disabled in https://github.com/AlecAivazis/survey/pull/216/files#diff-3a029c8ea50304c9dc5637560df2375bc28f1620d72744a13f4d3c152bb16a4aR120 and doesn't run. I'm working on separate PR to re-enable them (or most of them) => #354. Meanwhile I noticed that this PR breaks one of the existing tests; didn't check yet if a real bug, but I suggest holding on merging this until we have the tests back.

AlecAivazis commented 3 years ago

Going to close this as its gone a bit stale