summaryrefslogtreecommitdiffstats
path: root/vendor/gix-credentials/tests/program
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gix-credentials/tests/program')
-rw-r--r--vendor/gix-credentials/tests/program/from_custom_definition.rs42
-rw-r--r--vendor/gix-credentials/tests/program/mod.rs1
2 files changed, 43 insertions, 0 deletions
diff --git a/vendor/gix-credentials/tests/program/from_custom_definition.rs b/vendor/gix-credentials/tests/program/from_custom_definition.rs
new file mode 100644
index 000000000..1b9d8a056
--- /dev/null
+++ b/vendor/gix-credentials/tests/program/from_custom_definition.rs
@@ -0,0 +1,42 @@
+use gix_credentials::{program::Kind, Program};
+
+#[test]
+fn script() {
+ assert!(
+ matches!(Program::from_custom_definition("!exe").kind, Kind::ExternalShellScript(script) if script == "exe")
+ );
+}
+
+#[test]
+fn name_with_args() {
+ let input = "name --arg --bar=\"a b\"";
+ let expected = "git credential-name --arg --bar=\"a b\"";
+ assert!(
+ matches!(Program::from_custom_definition(input).kind, Kind::ExternalName{name_and_args} if name_and_args == expected)
+ );
+}
+
+#[test]
+fn name() {
+ let input = "name";
+ let expected = "git credential-name";
+ assert!(
+ matches!(Program::from_custom_definition(input).kind, Kind::ExternalName{name_and_args} if name_and_args == expected)
+ );
+}
+
+#[test]
+fn path_with_args() {
+ let input = "/abs/name --arg --bar=\"a b\"";
+ assert!(
+ matches!(Program::from_custom_definition(input).kind, Kind::ExternalPath{path_and_args} if path_and_args == input)
+ );
+}
+
+#[test]
+fn path() {
+ let input = "/abs/name";
+ assert!(
+ matches!(Program::from_custom_definition(input).kind, Kind::ExternalPath{path_and_args} if path_and_args == input)
+ );
+}
diff --git a/vendor/gix-credentials/tests/program/mod.rs b/vendor/gix-credentials/tests/program/mod.rs
new file mode 100644
index 000000000..3672dd18e
--- /dev/null
+++ b/vendor/gix-credentials/tests/program/mod.rs
@@ -0,0 +1 @@
+mod from_custom_definition;