#![allow(deprecated)]
#[cfg(test)]
mod tests {
use assert_cmd::Command;
use predicates::prelude::*;
use std::fs;
use tempfile::TempDir;
#[test]
#[ignore] fn test_context_skips_large_files_by_default() {
let temp_dir = TempDir::new().unwrap();
let project_path = temp_dir.path();
fs::write(project_path.join("main.rs"), "fn main() {}\n").unwrap();
let large_content = "a".repeat(600_000);
fs::write(project_path.join("large.js"), large_content).unwrap();
let mut cmd = Command::cargo_bin("pmat").unwrap();
cmd.arg("context")
.arg("-p")
.arg(project_path)
.assert()
.success()
.stderr(predicate::str::contains("Skipped:"))
.stderr(predicate::str::contains("large.js"))
.stderr(predicate::str::contains("large file >500KB"));
}
#[test]
#[ignore] fn test_context_includes_large_files_with_flag() {
let temp_dir = TempDir::new().unwrap();
let project_path = temp_dir.path();
fs::write(project_path.join("main.rs"), "fn main() {}\n").unwrap();
let mut large_content = String::new();
for i in 0..10_000 {
large_content.push_str(&format!("function test{i} () {{ return {i}; }}\n"));
}
fs::write(project_path.join("large.js"), large_content).unwrap();
let mut cmd = Command::cargo_bin("pmat").unwrap();
cmd.arg("context")
.arg("-p")
.arg(project_path)
.arg("--include-large-files")
.assert()
.success()
.stderr(predicate::str::contains("Skipped:").not());
}
#[test]
#[ignore] fn test_context_progress_bars() {
let temp_dir = TempDir::new().unwrap();
let project_path = temp_dir.path();
fs::write(project_path.join("main.rs"), "fn main() {}\n").unwrap();
fs::write(project_path.join("lib.rs"), "pub fn lib() {}\n").unwrap();
let mut cmd = Command::cargo_bin("pmat").unwrap();
cmd.arg("context")
.arg("-p")
.arg(project_path)
.assert()
.success();
}
#[test]
#[ignore] fn test_context_help_shows_include_large_files() {
let mut cmd = Command::cargo_bin("pmat").unwrap();
cmd.arg("context")
.arg("--help")
.assert()
.success()
.stdout(predicate::str::contains("--include-large-files"))
.stdout(predicate::str::contains("Include large files (>500KB)"));
}
}