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'")?, '❤'); assert_eq!(engine.eval::(r#"let x="hello"; x[2]"#)?, 'l'); assert_eq!( engine.eval::(r#"let x="hello"; x[2]='$'; x"#)?, "he$lo".to_string() ); assert!(engine.eval::("'\\uhello'").is_err()); assert!(engine.eval::("''").is_err()); Ok(()) }