Skip to content
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

single file test support #1610

Open
abritov opened this issue Nov 8, 2024 · 7 comments
Open

single file test support #1610

abritov opened this issue Nov 8, 2024 · 7 comments
Assignees
Labels
Additional info please Further information is requested
Milestone

Comments

@abritov
Copy link

abritov commented Nov 8, 2024

Is it possible to add a file argument to test command like that: c3c test src/foo.c3 so it can test single file?

@lerno
Copy link
Collaborator

lerno commented Nov 13, 2024

Use c3c compile-test src/foo.c3 perhaps?

@lerno lerno self-assigned this Nov 13, 2024
@lerno lerno added the Additional info please Further information is requested label Nov 13, 2024
@abritov
Copy link
Author

abritov commented Nov 14, 2024

Thank you for reply!
I tried compile-test command and it could not find imports:

~/c/c/hello ❱ ../c3c test
Program linked to executable 'build/testrun'.
Launching ./build/testrun
------------- TESTS -------------
Testing bar::test_imports .. [ok]

1 test run.

Test Result: ok. 1 passed, 0 failed.
Program completed with exit code 0.
~/c/c/hello ❱ ../c3c compile-test src/bar.c3
1: module bar;
2: import foo;
          ^^^
(/home/fitumi/code/c3/hello/src/bar.c3:2:8) Error: No module named 'foo' could be found, did you type the name right?

@lerno
Copy link
Collaborator

lerno commented Nov 14, 2024

Well, did you include the file with the foo module on the command line?

@abritov
Copy link
Author

abritov commented Nov 15, 2024

I did not. I expect test command to work like in cargo, where you can run a single test:
cargo test tests::test_rc4
The point is to bind this command to hotkey in vim/emacs. I'm not sure how to do it if I need to pass additional arguments

@lerno
Copy link
Collaborator

lerno commented Nov 15, 2024

This is not available yet. I was thinking there wasn't a huge need for it since the test runner is configurable. You can have a look at fn bool default_test_runner() in runtime.c3. For one that function could be changed to take arguments, such as the tests to run. The intention was that an IDE would swap the test runner for its own implementation for maximum control.

@lerno lerno added this to the 0.7 milestone Nov 16, 2024
@abritov
Copy link
Author

abritov commented Nov 17, 2024

Can you provide an example of how IDE's would swap the runner? For my own experimenting I can make a fork, but how it will work for IDE's?

@lerno
Copy link
Collaborator

lerno commented Nov 17, 2024

There is the --testfn command line option. Use this to pass in the name of the alternative tester function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Additional info please Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants