-rm -rf test/test_dir
-./add_dir.sh test/test_dir
-cp test/test_files/test.md test/test_dir/
-cp test/test_files/foo.rst test/test_dir/
-cp test/test_files/bar\ baz.md test/test_dir/
-cd test/test_dir
+# Set up test directory.
+expected_files_dir="test/test_files"
+expected_files_dir_escaped="test\\/test_files"
+generated_files_dir="test/test_dir"
+generated_files_dir_escaped="test\\/test_dir"
+rm -rf "$generated_files_dir"
+./add_dir.sh "$generated_files_dir"
+working_dir=$(pwd)
+cp "$expected_files_dir"/test.md "$generated_files_dir"/
+cp "$expected_files_dir"/foo.rst "$generated_files_dir"/
+cp "$expected_files_dir"/bar\ baz.md "$generated_files_dir"/
+cd "$generated_files_dir"