use rhai::{Engine, EvalAltResult}; #[test] fn test_chars() -> Result<(), EvalAltResult> { let mut engine = Engine::new(); assert_eq!(engine.eval::("'y'")?, 'y'); assert_eq!(engine.eval::("'\\u2764'")?, '❤'); #[cfg(not(feature = "no_index"))] { assert_eq!(engine.eval::(r#"let x="hello"; x[2]"#)?, 'l'); assert_eq!( engine.eval::(r#"let y="hello"; y[2]='$'; y"#)?, "he$lo" ); } assert!(engine.eval::(r"'\uhello'").is_err()); assert!(engine.eval::("''").is_err()); Ok(()) }