| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #59964 +/- ##
==========================================
- Coverage 88.41% 88.41% -0.01%
==========================================
Files 703 703
Lines 207398 207419 +21
Branches 39987 39997 +10
==========================================
+ Hits 183374 183390 +16
- Misses 15995 15998 +3
- Partials 8029 8031 +2 see 28 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
Sorry, something went wrong.
PR-URL: #59964 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
PR-URL: #59964 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
PR-URL: #59964 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
| Back | FazBrowse Home | New Git URL |
This PR adds a new testing utility called startNewREPLSever which simply starts a new repl server that can be used for testing.
The reasoning for proposing this change are to reduce unnecessary code repetition (notice that the PR is net removing more than 450 lines of code1) and to also provide some consistency on how repl server are tested.
Currently in tests when a new repl server gets started some input/output streams need to be passed to it, sometimes they are implemented via new stream.PassThrough(), some other times (more commonly) via new ArrayStream(), sometimes a single stream is passed both as the input and output, sometimes different streams are passed instead.
In most cases (as far as I can tell) there isn't a specific reason as to why an implementation has been chosen or not. startNewREPLSever removes this variation by adopting what looked to me like the most commonly used implementation aspects.
Another nice thing is that startNewREPLSever helps with variable name consistency. Currently when a test repl server is started it is stored in a variable which name can be r, replServer, server or testMe. Input streams can be input, putIn or inputStream. Output streams can be output, putIn or outputStream. (I am likely forgetting some variation too). startNewREPLSever consistently refers to these values respectively as replServer , input and output.
Please note that my PR is not replacing all repl server starts in tests with startNewREPLSever, mainly because sometimes that is not helpful (for example when testing the repl constructor default values) or because it would require some involved refactoring (and I think that this PR is pretty big as it is 😅, if this lands I can also see as a followup if startNewREPLSever could, be used in a few other tests as well)
Footnotes
The output accumulation logic is re-implemented multiple times as well as the error domain on error handler logic. ↩