#![allow(missing_docs)]
use predicates::prelude::*;
use std::io::Write;
#[test]
fn test_regression_080_stdin_with_dash_argument() {
let mut cmd = assert_cmd::cargo::cargo_bin_cmd!("ruchy");
cmd.arg("run")
.arg("-")
.write_stdin("fun main() { println(\"Hello from stdin\"); }")
.assert()
.success()
.stdout(predicate::str::contains("Hello from stdin"));
}
#[test]
fn test_regression_080_stdin_syntax_error() {
let mut cmd = assert_cmd::cargo::cargo_bin_cmd!("ruchy");
cmd.arg("run")
.arg("-")
.write_stdin("fun main() { invalid syntax }")
.assert()
.failure()
.stderr(predicate::str::contains("error").or(predicate::str::contains("Error")));
}
#[test]
fn test_regression_080_stdin_empty() {
let mut cmd = assert_cmd::cargo::cargo_bin_cmd!("ruchy");
cmd.arg("run")
.arg("-")
.write_stdin("")
.assert()
.failure() .stderr(predicate::str::contains("Empty program"));
}
#[test]
fn test_regression_080_eval_flag_still_works() {
assert_cmd::cargo::cargo_bin_cmd!("ruchy")
.arg("-e")
.arg("println(\"Hello from -e\")")
.assert()
.success()
.stdout(predicate::str::contains("Hello from -e"));
}
#[test]
fn test_regression_080_file_argument_still_works() {
use tempfile::NamedTempFile;
let mut temp_file = NamedTempFile::new().unwrap();
writeln!(temp_file, "fun main() {{ println(\"Hello from file\"); }}").unwrap();
assert_cmd::cargo::cargo_bin_cmd!("ruchy")
.arg("run")
.arg(temp_file.path())
.assert()
.success()
.stdout(predicate::str::contains("Hello from file"));
}