@@ -661,6 +661,30 @@ fn config_location_test() {
661661 .stdout("not-existing.conf\n");
662662}
663663
664+#[test]
665+fn config_location_when_generating() {
666+ let tmp_config_path = std::path::PathBuf::from("/tmp/should-be-created.conf");
667+
668+ // Make sure the file does not exist before the test is run
669+ // If this fails, run the following before running tests:
670+ // rm /tmp/should-be-created.conf
671+ assert!(!tmp_config_path.exists());
672+
673+ // Create the file with bat
674+ bat_with_config()
675+ .env("BAT_CONFIG_PATH", tmp_config_path.to_str().unwrap())
676+ .arg("--generate-config-file")
677+ .assert()
678+ .success()
679+ .stdout("Success! Config file written to /tmp/should-be-created.conf\n");
680+
681+ // Now we expect the file to exist. If it exists, we assume contents are correct
682+ assert!(tmp_config_path.exists());
683+
684+ // Cleanup
685+ std::fs::remove_file(tmp_config_path).unwrap();
686+}
687+
664688#[test]
665689fn config_read_arguments_from_file() {
666690 bat_with_config()