-
Notifications
You must be signed in to change notification settings - Fork 57
Test framework and testing solution for cito #44
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
Comments
Thank you! I like your idea. I have experience with:
I'd appreciate your help in designing a unit testing framework. Please start. One problem would be selecting one of the competing frameworks for every target language. Perhaps we could support many per language? Also, there's no PHP backend yet. Adding one is also a good idea. |
Is this an option? If it is, great. However it comes with other difficulties, for example jUnit4 vs jUnit5 have different APIs, for example regarding exceptions,so does PhpUnit7 vs PhpUnit8. I assume the biggest priority is that tests written in Ć, must be transpiled to all supported languages and run in those as well. I'll start working on the idea today night, and I'll present my idea in the morning, is that all right? :) |
PS: @pfusik How do you decide what language version to transpile to? For example you always transpile Java to Java8? Or how do you choose that? |
It used to have options for language versions: C89 vs C99, Perl 5.8 vs 5.10, old-style JavaScript vs JavaScript with typed arrays. These haven't aged well: MSVC supports C99 since 2013, no-one uses Perl 5.8 and even IE supports typed arrays now, I think. Current strategy is to support the latest versions available: C++20 (which has no full compiler yet), .NET 5, etc. |
So I understand C, C++, JS and Java are your primary concern and you will support Java, Scala and Python as a secondary concern? Or are all of them equally important? And my second question, is there a way to run just Ć, without transpiling it to anything? Or maybe to implicitly transpile it to something that always work like And BTW, I think you should support Go in ć, i think this could be a really Big selling Point of your langauge. |
Java isn't "more important" than Python. What made you think so? Both are popular languages and I want There's no way to run Ć natively. I imagine that tests would be transpiled same way as any other Ć code, then compiled and run using existing target-specific tools. Since As for Go, please file another ticket. |
@pfusik I've got some ideas and solutions for the tests in Ć. Is there a place where we can share ideas? Perhaps gitter would be good. |
I don't know about gitter, but there's a Discussions tab here on GitHub that I recently enabled. |
@pfusik Gitter is like slack dedicated for special repositories. There's gitter for ruby on rails, gitter for django, gitter for angular, etc. But I think discussions are fine too :) |
I think building a very simple test framework into fusion (rather than relying on the testing frameworks in each target language) is the move here. We can be inspired by rust tests, which allows you to very simply declare tests in the same source files, for example: fn add(n: u32, y: u32) -> u32 {
return n + y;
}
#[test]
fn it_works() {
let result = add(2, 2);
assert!(result == 4);
} The only thing that denotes the later function a test is the Since fusion doesn't support top level functions (neither to some of our target languages) our tests could be in dedicated classes: class Tests
{
#[test]
public void TestUtilSomething()
{
assert Util.Something() == true;
}
} Or they could even be directly in the logic classes themselves: class Adder
{
public int Add(int x, int y)
{
return x + y;
}
#[test]
public void TestAdd()
{
assert Add(2, 2) == 4;
}
} This capability would allow us to test private functions, and since fusion requires a parameterless constructor we will not have any issues creating an instance of the class to run the test. We would need to write a new The hardest part would probably be actually running all the tests, because fut would need to know about various native language compilers/interpreters. Perhaps for the first version we can skip this and leave running the tests up to the developer. |
Hi! I love your idea for a language specifically designed to be transpiled to other languages! I myself code with multiple langauges and always missed the option like this.
However, I find it stupidly absent that there's no solution for testing your application in Ć so far, for me, I could start using it right now, but I use TDD for 8 years now, and that's a big deal braker for me.
I find it necessary for two reasons.
unittest
vspytest
will be hard to choose).I could help you develop such a solution or code it, since I know all the supported languages (c#, java, php, python and c).
The text was updated successfully, but these errors were encountered: