Sha256: 7c5a38ed28bf9678108defca7b88ecc4bcdf3d39d08f553f147ef945e396a335
Contents?: true
Size: 826 Bytes
Versions: 19
Compression:
Stored size: 826 Bytes
Contents
use magnus::prelude::*; #[test] fn it_works_across_type() { let ruby = unsafe { magnus::embed::init() }; assert!(ruby.str_new("example").enc_get() == ruby.utf8_encindex()); assert!(ruby.sym_new("example").enc_get() == ruby.usascii_encindex()); assert!(ruby.to_symbol("example").enc_get() == ruby.usascii_encindex()); // symbol upgrades to utf8 when required assert!(ruby.sym_new("🦀").enc_get() == ruby.utf8_encindex()); assert!(ruby.to_symbol("🦀").enc_get() == ruby.utf8_encindex()); let regexp = ruby.reg_new("example", Default::default()).unwrap(); assert!(regexp.enc_get() == ruby.usascii_encindex()); // regexp also upgrades to utf8 when needed let regexp = ruby.reg_new("🦀", Default::default()).unwrap(); assert!(regexp.enc_get() == ruby.utf8_encindex()); }
Version data entries
19 entries across 19 versions & 1 rubygems