Skip to content

Commit

Permalink
Merge https://github.com/extendr/libR-sys into ignore_constants
Browse files Browse the repository at this point in the history
  • Loading branch information
CGMossa committed Oct 7, 2023
2 parents cd09e6c + a452bff commit c570d73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
18 changes: 0 additions & 18 deletions .vscode/tasks.json

This file was deleted.

12 changes: 2 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit c570d73

Please sign in to comment.