-
-
Notifications
You must be signed in to change notification settings - Fork 14
Add simple test suite #16
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
Conversation
if (runAsync) | ||
runTask(fun, args); | ||
else | ||
return fun(args); |
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.
Actually the async processing isn't really safe and might loose jobs, maybe we never want to do things asynchronously?
I don't know how "safe" Vibe.d's runTask
is, so leaving this decision to you.
"/github/repos/dlang/phobos/issues/4921/comments", | ||
"/bugzilla/buglist.cgi?bug_id=8573&ctype=csv&columnlist=short_desc", | ||
"/github/repos/dlang/phobos/issues/comments/262784442", | ||
(scope HTTPServerRequest req, scope HTTPServerResponse res){ |
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.
Unfortunately just (scope req, scope res)
doesn't work, because D isn't smart enough yet to figure the types out automatically, but imho this is nice enough for the beginning?
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.
That's fine and also comes with clearer error messages.
Technically it's possible to pass a polymorphic lambda to a template and check whether it's instantiatable though.
The error messages are not so good, b/c you can't know which type was meant.
void foo(Args...)()
{
static if (__traits(compiles, Args[0](12)))
{
pragma(msg, "int");
}
else static if (__traits(compiles, Args[0]("string")))
{
pragma(msg, "string");
}
}
void test()
{
foo!(a => 2 * a);
foo!(a => a ~ "foo");
}
@@ -0,0 +1,82 @@ | |||
import app; | |||
import utils; |
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.
Argh the GitHub file detection is still broken:
if (expectation.reqHandler !is null) | ||
return expectation.reqHandler(req, res); | ||
|
||
string filePath = buildPath(payloadDir, req.requestURL[1 .. $].replace("/", "_")); |
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 moved all payloads in one folder and use this /
-> _
replacement rule, s.t. one can have a good overview of all available payloads.
It's still simple to fetch new requests, e.g.
api=repos/dlang/dmd/pulls/6328/commits && curl https://github.com/api/${api} > data/payloads/github_$(echo $api | tr '/' '_')
However if you prefer to have an exact 1:1 matching with folders, I wouldn't mind either.
edit: Note that to simplify testing I added the option to provide a jsonHandler
and thus modify the json output - or in other words. We will have to do file reading manually anyways.
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.
Sounds fine for now.
With the improvement ideas from #15