-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
tests framework #561
tests framework #561
Conversation
couldn't figure out how to access fields of a struct in a macro, so I gave up and only construct the struct at the end
only failures print
load jl/test.jl on startup
to prevent collision with existing build test suite
Oh, and as mentioned in #560, file and directory tests aren't exposed yet. I used a silly solution involving the |
Fails on linux:
|
Ah. The former error must be because the The latter is not currently unexpected. The test scripts are supposed to be loaded in a Task, and if they're not, I'm not surprised that they fail. Ideally I guess they shouldn't. But for now, to test a single file, |
You might just wait on (or build on top of) #521. There's an abstraction for |
Thanks for the code, and the compliment! The syntax The args array indexing thing sounds like something that should be filed as a separate issue. |
Also, I may not have read it thoroughly enough to fully understand what's going on, but you generally don't want to call Also it is generally preferred style in macros to evaluate things as soon as possible. For example whether |
For linux you would want to do
Also, you'd have to take the lower case of everything to make it work on all system as the Linux output is lower case. Regarding libuv, it has a stat abstraction, but I have not implemented the FS abstraction within Julia yet (mainly because Julia's FS IO just works\tm on Windows), but I'll do that as soon as the rest is done. |
OK, thanks all. It sounds like I should wait on the file system stuff until libuv settles. In the meantime, I'll comment out Jeff, I'll see if I can figure out how to make the macro more Juliaesque (Juliaish? Julie?). I tried that initially, but had trouble figuring out how to pass an unevaluated expression to a function from a macro. The And I'll put together a simple demo of the args array indexing issue and file it as a bug. |
tests("test/test_test.jl") should work OK
Thanks to Jeff and Stefan for hints on getting this to work! Note that the expression indexing issue went away, and I wasn't able to reproduce it in a simpler test case.
|
@StefanKarpinski Can you review? I think a test framework will take a few iterations to get right, but we need to get started. |
Yeah, sorry, I've been meaning to go over this and keep getting sidetracked... |
also count the number of arguments to cache the compiled ccall
As hashed out in #8, I've put together a stab at a test framework that can be used for unit testing as well as (eventually) build testing. Note that right now this test framework is not used at all when you do
make test
.To see how it works, compile, then do
julia -e "tests()"
, which will run any files calledtest_*.jl
in or under the current directory. Note that the printer prints a dot for successful tests and dumps a structure for failures. Seetest\test_test.jl
to see the example test suite.Issues (tagged with TODO):
test_printer_simple
, needs to be slightly spiffed up to produce user-friendly text output.Aside from that, it was a pleasure to write this in Julia. Great language!