From d8ba4ec621d7cf169be97c8fc5e6f1db919681c9 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Fri, 14 May 2021 17:39:57 -0600 Subject: pass the tests locally on msvc --- src/lib.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/lib.rs (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..e3c7e47 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,28 @@ +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +include!(concat!(env!("OUT_DIR"), "/bindings.rs")); + +#[cfg(test)] +mod tests { + use super::*; + use std::ffi::CString; + + #[test] + fn two_plus_two() { + unsafe { + let interp = Tcl_CreateInterp(); + 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); + let result = Tcl_GetObjResult(interp); + let mut result_value = 0; + let get_int_status = Tcl_GetIntFromObj(interp, result, &mut result_value); + assert_eq!(get_int_status, TCL_OK as i32); + assert_eq!(result_value, 4); + + Tcl_DeleteInterp(interp); + } + } +} -- cgit v1.2.3