Sha256: 9b75c9ad6bbdc6b70d530351f444d44d3c84d87f7f2ee246737f517085c8b779
Contents?: true
Size: 709 Bytes
Versions: 19
Compression:
Stored size: 709 Bytes
Contents
use magnus::{prelude::*, rb_assert, Value}; #[test] fn it_can_check_frozen() { let ruby = unsafe { magnus::embed::init() }; assert!(ruby.eval::<Value>(r#"42"#).unwrap().is_frozen()); assert!(ruby.eval::<Value>(r#":foo"#).unwrap().is_frozen()); assert!(!ruby.eval::<Value>(r#"Object.new"#).unwrap().is_frozen()); assert!(!ruby.eval::<Value>(r#"[1]"#).unwrap().is_frozen()); assert!(ruby .eval::<Value>(r#"Object.new.freeze"#) .unwrap() .is_frozen()); assert!(ruby.eval::<Value>(r#"[1].freeze"#).unwrap().is_frozen()); let val = ruby.ary_new(); rb_assert!(ruby, "!val.frozen?", val); val.freeze(); rb_assert!(ruby, "val.frozen?", val); }
Version data entries
19 entries across 19 versions & 1 rubygems