Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prsabahrami committed Sep 28, 2024
1 parent 46166be commit 07609d3
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions crates/tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,16 @@ async fn pipeline() {
.run()
.await;

// TODO: implement tee in shell and then enable this test
// TestBuilder::new()
// .command(r#"echo 1 | tee output.txt"#)
// .assert_stdout("1\n")
// .assert_file_equals("output.txt", "1\n")
// .run()
// .await;

TestBuilder::new()
.command(r#"echo 1 | tee output.txt"#)
.assert_stdout("1\n")
.command(r#"echo 1 | cat > output.txt"#)
.assert_file_equals("output.txt", "1\n")
.run()
.await;
Expand Down Expand Up @@ -990,20 +997,30 @@ async fn touch() {
.run()
.await;

#[cfg(not(windows))]
TestBuilder::new()
.command("touch $TEMP_DIR/non_existent_dir/non_existent.txt")
.assert_stderr_contains("No such file or directory")
.assert_exit_code(1)
.run()
.await;

// Test with -h option on a symlink
#[cfg(windows)]
TestBuilder::new()
.command("touch original.txt && ln -s original.txt symlink.txt && touch -h symlink.txt")
.assert_exists("symlink.txt")
.command("touch $TEMP_DIR/non_existent_dir/non_existent.txt")
.assert_stderr_contains("The system cannot find the path specified")
.assert_exit_code(1)
.run()
.await;

// TODO: implement ln in shell and then enable this test
// // Test with -h option on a symlink
// TestBuilder::new()
// .command("touch original.txt && ln -s original.txt symlink.txt && touch -h symlink.txt")
// .assert_exists("symlink.txt")
// .run()
// .await;

// Test with multiple files, including one that doesn't exist
TestBuilder::new()
.command("touch existing.txt && touch existing.txt nonexistent.txt another_existing.txt")
Expand Down

0 comments on commit 07609d3

Please sign in to comment.