#![allow(missing_docs)]
use assert_cmd::Command;
use predicates::prelude::*;
fn ruchy_cmd() -> Command {
assert_cmd::cargo::cargo_bin_cmd!("ruchy")
}
#[test]
#[ignore = "Single-quoted strings not yet implemented - parsed as lifetimes"]
fn test_parser_072_single_quoted_string_basic() {
let code = r#"
let msg = 'hello world'
println("{}", msg)
"#;
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout(predicate::str::contains("hello world"));
}
#[test]
fn test_parser_072_single_vs_double_quotes_equivalent() {
let code = r#"
let double = "hello"
let single = 'hello'
println("{}", double == single)
"#;
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout(predicate::str::contains("true"));
}
#[test]
fn test_parser_072_single_quoted_with_escapes() {
let code = r#"
let escaped = 'hello\nworld'
println("{}", escaped)
"#;
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout(predicate::str::contains("hello\nworld"));
}
#[test]
fn test_parser_072_single_quoted_empty_string() {
let code = r#"
let empty = ''
println("{}", empty)
"#;
ruchy_cmd().arg("-e").arg(code).assert().success();
}
#[test]
#[ignore = "Single-quoted strings not yet implemented - parsed as lifetimes"]
fn test_parser_072_single_quoted_with_embedded_double_quotes() {
let code = r#"
let msg = 'She said "hello"'
println("{}", msg)
"#;
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout(predicate::str::contains("She said \"hello\""));
}
#[test]
fn test_parser_072_char_literal_still_works() {
let code = r#"
let ch = 'x'
println("{}", ch)
"#;
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout(predicate::str::contains("x"));
}
#[test]
fn test_parser_072_transpile_mode() {
let code = r#"
let msg = 'hello'
println("{}", msg)
"#;
let temp_file = "/tmp/test_parser_072_transpile.ruchy";
std::fs::write(temp_file, code).expect("Failed to write temp file");
ruchy_cmd()
.arg("transpile")
.arg(temp_file)
.assert()
.success()
.stdout(predicate::str::contains("let"))
.stdout(predicate::str::contains("hello"));
}
#[test]
#[ignore = "Single-quoted strings not yet implemented - parsed as lifetimes"]
fn test_parser_072_check_mode() {
let code = r"
let msg = 'hello world'
";
let temp_file = "/tmp/test_parser_072_check.ruchy";
std::fs::write(temp_file, code).expect("Failed to write temp file");
ruchy_cmd().arg("check").arg(temp_file).assert().success();
}
#[test]
#[ignore = "Single-quoted strings not yet implemented - parsed as lifetimes"]
fn test_parser_072_single_quoted_string_in_function() {
let code = r#"
fun greet(name) {
'Hello, ' + name + '!'
}
println("{}", greet('Alice'))
"#;
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout(predicate::str::contains("Hello, Alice!"));
}
#[test]
fn test_parser_072_single_quoted_string_concatenation() {
let code = r#"
let result = 'hello' + ' ' + 'world'
println("{}", result)
"#;
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout(predicate::str::contains("hello world"));
}