Comments (9)
This is now completed! All test of the core library can now be executed by ./vendor/bin/phel test
from phel-lang.
I updated the Report section. What do you think?
from phel-lang.
Since (deftest) is the same as (defn) which is the same as (def) why can't we add (deftest) macro in the core and thus avoid adding :refer to the (ns)?
I see the :refer
not only useful for this case. It can also be quite useful for library developers to extend Phel with some nice APIs. For example an if anyone whats to define a routing library, he can define a defroute
macro like this:
(defroute "/my/route/:id" [request]
"hello world")
Could we add a command for vendor/bin/phel test namespace/file/test-name?
Sure!
from phel-lang.
I really like the idea of using .
, F
or E
and to print the detailed output at the end. I think that most test libraries do like this and it produce a good and readable output.
I think it would be pretty useful to print the expected value on test failure. It would help developers to understand what is going on without having to manually print the test's parameters. Quasi-quotation could help here.
Here is an example of what I'm thinking about:
(defmacro assertt
[test label]
`(assert ,test (str ,label ", Expected: " ,(print-str test)))
)
(assertt (= 1 2) "Test case")
And the output of this would be e Test case, Expected: (= 1 2)
.
Then I have a question about run-tests
, we would have to pass as parameters all tests that we want to execute right? Maybe auto-discovery of the tests cases (just like phpunit does) would be nice. Then you don't have to worry about forgetting to add one of your tests to the list. And then (again, just like phpunit), we could add a flag or something similar to run only tests that match a pattern, are in some namespace, or even eventually in a test suite (this would require to add something like deftestsuite
btw).
from phel-lang.
@paullaffitte Thanks for your input. I will add more details in the report section, on how failure and error message should look like (with examples).
Regarding run-tests
. This function is the base for running all tests. It's a good idea to add auto-discovery. That can be build on top of run-tests. I thinks this can be done with the vendor/bin/phel test
command. If no namespace is provided all test should run.
from phel-lang.
Great work! Really loving how the language is turning out. Sorry I can't contribute more to the code. I have my hands full atm... but testing and experimenting is what I love to do in the morning, so I will give it a go and report back.
from phel-lang.
Looks very useful and simple, but I have some questions/suggestions.
Since (deftest) is the same as (defn) which is the same as (def) why can't we add (deftest) macro in the core and thus avoid adding :refer to the (ns)?
As an alternative, why not just use (defn) and tell people to add metadata @{:test true} for writing tests?
Could we add a command for vendor/bin/phel test namespace/file/test-name
?
from phel-lang.
I see. Makes sense now. Thank you for explaining the use case a little bit more.
from phel-lang.
Current Status:
- I implemented the framework as described above
- I updated the old tests to the new test framework
- I added the test framework documentation on the website
What is left:
- Autodiscovery of all tests
./vendor/bin/phel test
command
from phel-lang.
Related Issues (20)
- Add __name__ to identify the execution of a script HOT 2
- Create int function HOT 2
- Add default format paths HOT 1
- require scope loads *build-mode* code HOT 5
- php/apush and php/aset not working as expected HOT 2
- CI does not fail when a phel test fails
- Language support in PhpStorm HOT 4
- Not able to execute generated php code HOT 4
- Add phel config file automatic after requiring phel
- NodeEnvironment error being thrown when calling `doc` in the REPL
- Some functions are missing in the API HOT 2
- Improve error messages in the REPL HOT 2
- Cannot run php code generated with build HOT 3
- Invalid build entry point
- Improve error reporting for deprecated notes
- First argument of 'ns must be a Symbol
- Add hacktoberfest topic for this month HOT 2
- Use run command by default HOT 1
- Create executable phar
- Notify user when running a non existing phel file
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 phel-lang.