#![cfg(test)]
#![allow(warnings)]
#![allow(clippy::assertions_on_constants)]
#![allow(clippy::unreadable_literal)]
#![allow(clippy::expect_used)]
#![allow(clippy::needless_raw_string_hashes)]
#![allow(clippy::unwrap_used)]
#![allow(clippy::needless_raw_string_hashes)]
#![allow(unused_variables)]
use ruchy::runtime::Repl;
use std::env;
#[test]
fn test_for_loop_with_list() {
let mut repl = Repl::new(std::env::temp_dir()).expect("Failed to create REPL");
let result = repl.eval(
r#"
let sum = 0;
for x in [1, 2, 3] {
let sum = sum + x
};
sum
"#,
);
let result2 = repl.eval(r#"for x in [1, 2, 3] { println(x) }"#);
assert!(result2.is_ok());
}
#[test]
fn test_while_loop_basic() {
let mut repl = Repl::new(std::env::temp_dir()).expect("Failed to create REPL");
let result = repl.eval(
r#"
let i = 0;
while i < 3 {
let i = i + 1
};
i
"#,
);
assert!(result.is_ok());
}
#[test]
fn test_while_loop_with_counter() {
let mut repl = Repl::new(std::env::temp_dir()).expect("Failed to create REPL");
assert!(repl.eval("let counter = 0").is_ok());
let result = repl.eval("while counter < 2 { println(counter); let counter = counter + 1 }");
assert!(result.is_ok());
}