diff options
author | Melody Horn <melody@boringcactus.com> | 2021-05-14 21:04:01 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-05-14 21:04:01 -0600 |
commit | c6a84931c7489d72112ac13b7e597c3a456ef770 (patch) | |
tree | c67a1e9473016ac20844dda51cb868b31af025e5 | |
parent | ffa5460bbf2fc5a3fd9f40dc87b277ddcd3a6723 (diff) | |
download | tcl-sys-c6a84931c7489d72112ac13b7e597c3a456ef770.tar.gz tcl-sys-c6a84931c7489d72112ac13b7e597c3a456ef770.zip |
test Tcl_Init which fails due to no stdlib
-rw-r--r-- | src/lib.rs | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -7,12 +7,20 @@ include!(concat!(env!("OUT_DIR"), "/bindings.rs")); #[cfg(test)] mod tests { use super::*; - use std::ffi::CString; + use std::ffi::{CStr, CString}; #[test] fn two_plus_two() { unsafe { let interp = Tcl_CreateInterp(); + let init_status = Tcl_Init(interp); + if init_status == TCL_ERROR as i32 { + eprintln!( + "{}", + CStr::from_ptr(Tcl_GetStringResult(interp)).to_string_lossy() + ); + } + assert_eq!(init_status, TCL_OK as i32); let script = CString::new("expr 2 + 2").unwrap(); let eval_status = Tcl_Eval(interp, script.as_ptr()); assert_eq!(eval_status, TCL_OK as i32); |