#![allow(missing_docs)]
use assert_cmd::Command;
fn ruchy_cmd() -> Command {
assert_cmd::cargo::cargo_bin_cmd!("ruchy")
}
#[test]
#[ignore = "union not implemented"]
fn test_union_basic() {
let code = r"
let a = [1, 2, 3];
let b = [3, 4, 5];
println(a.union(b))
";
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout("[1, 2, 3, 4, 5]\nnil\n");
}
#[test]
#[ignore = "union not implemented"]
fn test_union_with_duplicates() {
let code = r"
let a = [1, 2, 2, 3];
let b = [3, 3, 4, 5];
println(a.union(b))
";
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout("[1, 2, 3, 4, 5]\nnil\n");
}
#[test]
#[ignore = "intersection not implemented"]
fn test_intersection_basic() {
let code = r"
let a = [1, 2, 3, 4];
let b = [3, 4, 5, 6];
println(a.intersection(b))
";
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout("[3, 4]\nnil\n");
}
#[test]
#[ignore = "intersection not implemented"]
fn test_intersection_no_common() {
let code = r"
let a = [1, 2];
let b = [3, 4];
println(a.intersection(b))
";
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout("[]\nnil\n");
}
#[test]
#[ignore = "difference not implemented"]
fn test_difference_basic() {
let code = r"
let a = [1, 2, 3, 4];
let b = [3, 4, 5, 6];
println(a.difference(b))
";
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout("[1, 2]\nnil\n");
}
#[test]
#[ignore = "difference not implemented"]
fn test_difference_all_different() {
let code = r"
let a = [1, 2];
let b = [3, 4];
println(a.difference(b))
";
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout("[1, 2]\nnil\n");
}
#[test]
#[ignore = "difference not implemented"]
fn test_difference_all_removed() {
let code = r"
let a = [1, 2];
let b = [1, 2, 3];
println(a.difference(b))
";
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout("[]\nnil\n");
}
#[test]
#[ignore = "union not implemented"]
fn test_union_strings() {
let code = r#"
let a = ["a", "b"];
let b = ["b", "c"];
println(a.union(b))
"#;
ruchy_cmd()
.arg("-e")
.arg(code)
.assert()
.success()
.stdout("[\"a\", \"b\", \"c\"]\nnil\n");
}