diff --git a/src/fn_call.rs b/src/fn_call.rs index 4ac5a50d..f7836107 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -1280,7 +1280,7 @@ pub fn run_builtin_op_assignment( "/=" => return Ok(Some(*x /= y)), "%=" => return Ok(Some(*x %= y)), "~=" => return Ok(Some(*x = x.pow(y as u32))), - ">>=" => return Ok(Some(*x = *x << y)), + ">>=" => return Ok(Some(*x = *x >> y)), "<<=" => return Ok(Some(*x = *x << y)), _ => (), } diff --git a/tests/compound_equality.rs b/tests/compound_equality.rs index b09115a0..af5c16b6 100644 --- a/tests/compound_equality.rs +++ b/tests/compound_equality.rs @@ -45,16 +45,16 @@ fn test_divide_equals() -> Result<(), Box> { } #[test] -fn test_left_shift_equals() -> Result<(), Box> { +fn test_right_shift_equals() -> Result<(), Box> { let engine = Engine::new(); assert_eq!(engine.eval::("let x = 9; x >>=1; x")?, 4); Ok(()) } #[test] -fn test_right_shift_equals() -> Result<(), Box> { +fn test_left_shift_equals() -> Result<(), Box> { let engine = Engine::new(); - assert_eq!(engine.eval::("let x = 4; x<<= 2; x")?, 16); + assert_eq!(engine.eval::("let x = 4; x <<= 2; x")?, 16); Ok(()) }