diff options
author | Melody Horn <melody@boringcactus.com> | 2021-05-14 17:39:57 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-05-14 17:39:57 -0600 |
commit | d8ba4ec621d7cf169be97c8fc5e6f1db919681c9 (patch) | |
tree | 088a213f57bbdfc5901ad60b5aa7c96e0f5cabc5 /src | |
download | tcl-sys-d8ba4ec621d7cf169be97c8fc5e6f1db919681c9.tar.gz tcl-sys-d8ba4ec621d7cf169be97c8fc5e6f1db919681c9.zip |
pass the tests locally on msvc
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 28 |
1 files changed, 28 insertions, 0 deletions
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); + } + } +} |