about summary refs log tree commit diff
path: root/src/tools/rustfmt/check_diff/tests/bash_commands.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/rustfmt/check_diff/tests/bash_commands.rs')
-rw-r--r--src/tools/rustfmt/check_diff/tests/bash_commands.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/rustfmt/check_diff/tests/bash_commands.rs b/src/tools/rustfmt/check_diff/tests/bash_commands.rs
new file mode 100644
index 00000000000..38ee34ef503
--- /dev/null
+++ b/src/tools/rustfmt/check_diff/tests/bash_commands.rs
@@ -0,0 +1,12 @@
+use check_diff::change_directory_to_path;
+use std::env;
+use tempfile::Builder;
+
+#[test]
+fn cd_test() {
+    // Creates an empty directory in the current working directory
+    let dir = Builder::new().tempdir_in("").unwrap();
+    let dest_path = dir.path();
+    change_directory_to_path(dest_path).unwrap();
+    assert_eq!(env::current_dir().unwrap(), dest_path);
+}