diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 62016596..00000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "type": "cargo", - "subcommand": "test", - "problemMatcher": [ - "$rustc" - ], - "group": { - "kind": "build", - "isDefault": true - } - } - ] -} \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index eea9dff9..cd882a0a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -137,19 +137,11 @@ mod tests { fn test_eval() { start_R(); unsafe { - // In an ideal world, we would do the following. - // let res = R_ParseEvalString(cstr!("1"), R_NilValue); - // But R_ParseEvalString is only in recent packages. - - let s = Rf_protect(Rf_mkString(cstr!("1"))); - let mut status: ParseStatus = 0; - let status_ptr = &mut status as *mut ParseStatus; - let ps = Rf_protect(R_ParseVector(s, -1, status_ptr, R_NilValue)); - let val = Rf_eval(VECTOR_ELT(ps, 0), R_GlobalEnv); + let val = Rf_protect(R_ParseEvalString(cstr!("1"), R_NilValue)); Rf_PrintValue(val); assert_eq!(TYPEOF(val) as u32, REALSXP); assert_eq!(*REAL(val), 1.); - Rf_unprotect(2); + Rf_unprotect(1); } } }