-
Notifications
You must be signed in to change notification settings - Fork 67
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
cargo-process-current-*test* for functional tests #41
Comments
Hi, thanks for reporting. I fixed the current test issue in the latest commit: 486d9a6 I also made sure that We discussed briefly about running tests in a specific file #39 but I haven't been able to come up with a good solution yet. Using something like RLS (like you mentioned) would probably be the best option, but I don't know when I'll have to time to actually tackle a project like that. |
Great, I will try it as soon as melpa update arrive.
Funny that recently after you fixed of #39 I met corner case: #[test]
fn test_foreign_type_map_parsing() {
let parse_sess = ParseSess::new();
let types_map = parse_types_map(
&parse_sess,
"test",
r#"
mod foreign_types_map {
#![foreigner_type="boolean"]
#![rust_type="jboolean"]
#![foreigner_type="int"]
#![rust_type="jint"]
}
impl SwigInto<bool> for jboolean {
fn swig_into(self, _: *mut JNIEnv) -> bool {
self != 0
}
}
impl SwigFrom<bool> for jboolean {
fn swig_from(x: bool, _: *mut JNIEnv) -> Self {
if x { 1 as jboolean } else { 0 as jboolean }
}
}
impl SwigFrom<i32> for jint {
fn swig_from(x: i32, _: *mut JNIEnv) -> Self {
x
}
}
"#,
);
assert_eq!(types_map
.to_foreign_type_name(Symbol::intern("bool"))
.unwrap()
.0,
Symbol::intern("boolean")); cargo-process-current-test = But if install imenu-list I get right information I suppose emacs-racer gives this information to may be |
So the reason this case is breaking is because we use So technically speaking this is an issue on rust-mode's side, but quite an edge-case. We could try to hack our way around this but it would be better to fix it at the source. As for imenu, it could be used for finding all functions, but it doesn't distinguish if they have the [test] tag or not. Also AFAIK I don't think there's a way to find the function at point using imenu. One simple way of finding all file tests would be to parse the file for [test] tags, but it would be nice to have a better structure of course. |
Seems fixed at now, thanks. |
Funny, that every time I thought that now were covered all cases, #[test]
fn it_works() {
fn helper(a: i32) -> i32 {
a * 2
}
assert_eq!(helper(1), 2);
} If put cursor at P.S. This code of course is senseless, but in real code analog of |
If create dummy crate with
cargo new foo
,and create subdirectory
foo/tests
with such dummy context:
$ cat tests/dummy.rs
then
M-x cargo-process-current-test
can not run test (I placed cursor atprintln!
),because of it run
cargo test ::test_dummy
, while it should not use ::,so it runs 0 tests.
Plus
M-x cargo-process-current-file-tests
runcargo test nil
command,which one obviously not run any tests.
The text was updated successfully, but these errors were encountered: