use std::fs;
use crate::test_utils::*;
use anyhow::Result;
#[tokio::test]
async fn test_basic_cat() -> Result<()> {
let dir = tempfile::tempdir()?;
let dst_path = dir.path().join("dst.txt");
let expect = "hello";
fs::write(&dst_path, expect)?;
assert_cmd_snapshot!(oli().arg("cat").arg(dst_path), @r"
success: true
exit_code: 0
----- stdout -----
hello
----- stderr -----
");
Ok(())
}
#[tokio::test]
async fn test_cat_for_path_in_current_dir() -> Result<()> {
let dir = tempfile::tempdir()?;
let dst_path = dir.path().join("dst.txt");
let expect = "hello";
fs::write(&dst_path, expect)?;
assert_cmd_snapshot!( oli().arg("cat").arg("dst.txt").current_dir(dir.path()), @r"
success: true
exit_code: 0
----- stdout -----
hello
----- stderr -----
");
Ok(())
}