#![cfg(any(
not(any(
feature = "parser_tests",
feature = "analyzer_tests",
feature = "codegen_tests",
feature = "interpreter_tests",
feature = "conformance_tests",
feature = "integration_tests",
)),
feature = "parser_tests",
))]
use std::env;
use std::fs;
use std::path::PathBuf;
#[test]
#[cfg_attr(tarpaulin, ignore)]
fn test_decorator_with_keyword_args_parses() {
let _tmp = tempfile::tempdir().unwrap();
let test_dir = _tmp.path().join(format!(
"wj_decorator_kwargs_{}_{}",
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_nanos(),
std::process::id()
));
fs::create_dir_all(&test_dir).unwrap();
let test_content = r#"
use windjammer_runtime::test::*
@property_test(iterations=50, seed=42)
fn test_random_property(x: i32) {
assert(x != 0 || x == 0, "Always true")
}
"#;
fs::write(test_dir.join("prop_test.wj"), test_content).unwrap();
let wj_binary = PathBuf::from(env!("CARGO_BIN_EXE_wj"));
let output = std::process::Command::new(&wj_binary)
.arg("build")
.arg(test_dir.join("prop_test.wj"))
.arg("--no-cargo")
.output()
.expect("Failed to run wj build");
let stderr = String::from_utf8_lossy(&output.stderr);
let stdout = String::from_utf8_lossy(&output.stdout);
if stderr.contains("Expected pattern, got Assign")
|| stdout.contains("Expected pattern, got Assign")
{
panic!(
"Parser error 'Expected pattern, got Assign' occurred with keyword decorator args:\nSTDOUT:\n{}\nSTDERR:\n{}",
stdout, stderr
);
}
}