Sha256: 6b5e37db88481cb7d3748735bdfe671b75250c71788ed99d7573f0d295338e90
Contents?: true
Size: 663 Bytes
Versions: 19
Compression:
Stored size: 663 Bytes
Contents
use std::collections::HashMap; #[test] fn it_converts_hash_map() { let ruby = unsafe { magnus::embed::init() }; let map: HashMap<String, u8> = ruby .eval(r#"{"foo" => 1, "bar" => 2, "baz" => 3}"#) .unwrap(); let mut expected = HashMap::new(); expected.insert("foo".to_owned(), 1); expected.insert("bar".to_owned(), 2); expected.insert("baz".to_owned(), 3); assert_eq!(expected, map); let mut map = HashMap::new(); map.insert("test", (0, 0.5)); map.insert("example", (1, 3.75)); magnus::rb_assert!( ruby, r#"map == {"test" => [0, 0.5], "example" => [1, 3.75]}"#, map ); }
Version data entries
19 entries across 19 versions & 1 rubygems