-
Notifications
You must be signed in to change notification settings - Fork 33
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
Feature/time functions #91
base: master
Are you sure you want to change the base?
Feature/time functions #91
Conversation
src/timefns.c
Outdated
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.
We don't want to include the Emacs C source files
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 will remove them, I added them by mistake.
|
||
defvar!(CURRENT_TIME_LIST, true); | ||
|
||
const LO_TIME_BITS: u32 = 16; | ||
const TIMESPEC_HZ: u64 = 1000000000; | ||
const LOG10_TIMESPEC_HZ: u32 = 9; |
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.
can you run cargo clippy --workspace
and cargo fmt --workspace
?
you can add a new rune/elprop/src/bin/code/data.rs Line 32 in 4b5ae64
And then in the Another thing I have been considering is creating a proc macro like this #[defun]
#[elprop(<spec>, <spec>)]
fn time_add<'ob>(a: LispTime, b: LispTime, cx: &'ob Context) -> Object<'ob> { where you can specify exactly what the valid inputs should be (for example in the base64 case, the function is only meaningful on ascii and raw bytes). |
I completely agree about the custom elprop macro, that would allow us to created custom prop testing features. Let me see if I can think of something |
I improved elprop again to better handle panics and avoid timeouts. It still does not have special handling for time functions but it works much better now. I was able to find a handful of overflow issues with the |
I added a new |
Nice, I will continue fixing my functions. Also was wondering if it would be better to move the elprop tests into tests rather than converting it to json and then using a external runner. I feel that would give more room to create proptests in a easier fashion. |
not entirely sure what you mean. We can't convert them into Rust tests because we need to feed them to both Emacs and Rune. |
I meant why can they not be just normal rust tests, like
I don't know much about this, so I could be wrong, but I don't understand why that would be problem. I was looking at the Neovim based tests in the Zed editor and they run tests by passing commands to both Zed and a neovim backend in a test I think. |
I suppose you are right about that. We could have it just call it from a normal Rust test. However the structure is a little complex. Here is a diagram of all the executables involved in running elprop. On the top we have a shell script to make sure we are never running on old code. Then we have the top-level elprop binary which parses the Rust source code and extracts all the functions. It is here that we run into an issue; Emacs can't read input from stdin, or send data to stdout (except for batch error messages). But it can connect to stdin/stout of its own subprocesses. So we can't just call Emacs and Rune together to test them. Instead what we do is create a middleware binary called runner.rs. This is called as a subprocess of Emacs and can send data to both Emacs and Rune and compare the results. When it is done, we write out a JSON of the results which gets read by elprop.rs and the program terminates. If you think there is a way to simplify this. let me know! So we could call elprop from inside a regular Rust test (using |
Started adding the time functions.
Prop testing is kind of hard to do, as there is no way of passing correct type info to the the prop test strategy, any thoughts on what could be done?