Comments (4)
What about these additional methods for utest.Async
?
/**
Set the amount of times `async.done()` should be called for this async to be resolved.
**/
public function setDoneCount(count:Int):Void;
/**
Resolve this async no matter how many times `async.done()` was called.
**/
public function allDone():Void;
or / and
/**
Create a sub-async. Current `Async` instance will be resolved automatically once all sub-asyncs are resolved.
**/
public function branch():Async;
from utest.
branch
seems like the more useful one, since having to keep track of the done count manually could be tedious and prone to errors.
Personally I would prefer an API like:
public function branch(f:Async->Void):Void;
Where f
is invoked immediately with the "branched" Async
.
var doneSignalAsync = async.branch();
var dataSignalAsync = async.branch();
something.doneSignal.on(() -> doneSignalAsync.done());
something.dataSignal.on(() -> dataSignalAsync.done());
// vs
async.branch(async -> {
something.doneSignal.on(() -> async.done());
});
async.branch(async.done -> {
something.dataSignal.on(() -> async.done());
});
Less work having to think of new names :)
If there is a done count as well, then it could be an optional argument for branch
.
from utest.
Looks like a way to callback hell )
from utest.
Well yes, but what else do you want to do with callback-centric code? It will be nicer with coroutines but we need some underlying API anyway.
from utest.
Related Issues (20)
- UTest.run(cases, callback): callback not called
- Attempt to call a nil value error on Lua HOT 3
- Assert is not compatible with null safety
- Haxe < 4.1 compatibility HOT 2
- Make Sys.exit() after completion optional HOT 3
- Add method Assert.raisesMessage HOT 1
- 4.2 issue? Unmatched patterns: OpSpread HOT 2
- Deprecated Assert.is method in the documentation HOT 2
- Haxe 4.2.3: Doesnt work HOT 4
- php target is broken HOT 1
- Asynchronous tests are broken HOT 5
- async setupClass hangs (never displays results)
- Feature request: parametrizing tests HOT 2
- Partial object matching
- Null safety
- Class name pattern
- Simple way to print out running tests
- Assert.sameAs failure
- Release a new version for Haxe 4.1.0 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 utest.