Comments (5)
So MSpec uses temp files, and Seeing Is Believing uses IO.pipe
.
My reasoning was just that it didn't require me to deal with temp files. But I'm wondering if there's anything I'm failing to consider (ie why didn't MSpec use IO.pipe
?)
cc @brixen
from seeing_is_believing.
@JoshCheek MSpec does not use IO.pipe because it's a significantly more complex operation than writing to a file (which typically requires a pretty simple call to a system library). MSpec was built to be easy to use in a Ruby implementation that didn't have much working yet.
from seeing_is_believing.
Makes sense. I'm going to stick with IO.pipe
since my considerations are different. Thanks!
from seeing_is_believing.
More things to consider, based on #49:
- You cannot catch every exception, because, for example,
at_exit { raise "omg" }
this will execute after abegin/rescue/end
around the whole program. - These types of exceptions are handled by Ruby, before getting to the matrix's
at_exit
hook, it deals with them by printing some info to stderr (the normal error stuff you see all the time) - This causes a weird difference between exceptions in the code and exceptions in hooks.
- You cannot close stderr after the program runs, because it could be legitimate to print to stderr, e.g.
at_exit { $stderr.puts "now we run your test suite" }
So, what do we do?
- Could redefine
at_exit
to rescue the exception and record it right there... Sounded really stupid when I thought of it, but now it seems more legit. OTOH, there could be any number of ways that I just don't know of, that will get your code running at that time, and if anything ever changes, this code could be fragile. It looks likeat_exit
blocks are just a linked list of blocks to run, and there isn't anything else that deals with this stuff. - Could wrap
at_exit
blocks in special error handling code. This seemed better to me initially, but how do you determine a block being passed to anat_exit
hook from any other type of block? I can't think of a good way. - Could just ignore it and let the errors you see in at_exit hooks be printed in stderr as well.
from seeing_is_believing.
Going to go with "ignore it". If I redefine at_exit
, which I did, then it does not set $!
. We do this intentionally, to prevent Ruby from printing it to stderr, but it also means the next at_exit
hook can't see the error in $!
I tried hanging onto it and setting it right before invoking the next at_exit
hook, but turns out that is not allowed ($!
is a readonly variable -- probably b/c it's threadlocal or something, idk).
I think it's better to have edge cases where output is inconsistent than where behaviour is changed, so going to ignore it.
from seeing_is_believing.
Related Issues (20)
- Printing tabs replaces the output with "\t"
- Output is horrible when run against a moved file
- Thoughts after reading the help screen
- Uuhhhmm, add an in-place update flag
- Remove custom String#pp
- Should handle missing constants
- cross-invocation state HOT 1
- Outdated parser runtime dependency generates deprecation warning in Ruby 2.7 HOT 6
- VSCode Description isn't complete HOT 1
- Feature request: line which updates obviously to confirm file was reevaluated
- Endless method support
- Let errors in inspect raise
- Getting WARN -- : posix_spawn is not yet supported on x86_64-cygwin (x86_64-cygwin), falling back to default implementation. HOT 4
- Relaxing the FFI dependency version constraint HOT 9
- Ruby3 endless method bug
- Something funky with frozen string literals
- segfault *sigh*
- in `find_type': unable to resolve type 'intptr_t' (TypeError) HOT 3
- New release to support Apple Silicon (M1) Macs? HOT 3
- Unable to install seeing_is_believing on Apple M1 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seeing_is_believing.