Closed andresv closed 3 years ago
Thanks for the quick fix! Any reason you didn't go for raw identifiers?
Would be amazing to have a test for this too :)
rust-analyzer did not like them:
I guess they are not allowed in enums. Also I think it is more nicer to do
let r = Rsa2Tsgn3::X0Unlimited;
than
let r = Rsa2Tsgn3::#r0Unlimited;
At some point it should be probably documented in readme.
Test is coming up.
For testing it would be best to add such field to example.dbc
file. There is also example.kdc
what do to with that?
Ah, interesting. Seems like raw identifiers are only allowing Rust keywords, so maybe we can actually combine the approaches to allow variants called type
and similar?
Regarding tests, the KCD is to allow testing against node-socketcan. You can build it using the python tool canmatrix
, see here for how to install it with kcd support. I only do this once a year so if you get it to work feel free to add a line to one of the readmes :)
Thanks so much for contributing!
How do I actually run those tests (will add this to readme).
IIRC I only did the node tests manually -- for example to get lines like this.
Don't worry about it for now :)
It seems I do not understand cargo workspaces correctly. I tried:
cargo build --bin testing
cargo build --bin testing/rust_integration
cargo build --bin rust_integration
# nope
cargo test
# nope
cargo test --test testing
Give cargo test --all
a try :)
(You can cheat by looking at what is run on CI)
This change should be now covered with a test.
There isn't explicit test, but CI can check that indeed it builds so messages.rs
must contain valid Rust code.
I have a dbc file which contains:
Currently it generates:
Notice
0Unlimited
which is not allowed in Rust.This PR prepends
X
to such enum fields. So it becomes: