summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-02-07 10:16:16 +0100
committerAram Drevekenin <aram@poor.dev>2024-02-07 10:16:16 +0100
commitc0ee3df4705a8a7404c2c6bc4937a0443d69d23b (patch)
tree80e9073edefac6c4cf45b9dcbdc663dba3206ad8
parent5afcb232347a7dd1db79b036cbdad3157e600db9 (diff)
-rw-r--r--zellij-server/src/plugins/unit/plugin_tests.rs24
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_floating_plugin_command.snap8
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_plugin_command.snap8
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_floating_plugin_command.snap8
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_plugin_command.snap8
5 files changed, 40 insertions, 16 deletions
diff --git a/zellij-server/src/plugins/unit/plugin_tests.rs b/zellij-server/src/plugins/unit/plugin_tests.rs
index 6b6e345e1..98fe1a075 100644
--- a/zellij-server/src/plugins/unit/plugin_tests.rs
+++ b/zellij-server/src/plugins/unit/plugin_tests.rs
@@ -3841,7 +3841,11 @@ pub fn open_file_floating_plugin_command() {
}
})
.clone();
- assert_snapshot!(format!("{:#?}", new_tab_event));
+ // we do the replace below to avoid the randomness of the temporary folder in the snapshot
+ // while still testing it
+ assert_snapshot!(
+ format!("{:#?}", new_tab_event).replace(&format!("{:?}", temp_folder.path()), "\"CWD\"")
+ );
}
#[test]
@@ -3918,7 +3922,11 @@ pub fn open_file_plugin_command() {
}
})
.clone();
- assert_snapshot!(format!("{:#?}", new_tab_event));
+ // we do the replace below to avoid the randomness of the temporary folder in the snapshot
+ // while still testing it
+ assert_snapshot!(
+ format!("{:#?}", new_tab_event).replace(&format!("{:?}", temp_folder.path()), "\"CWD\"")
+ );
}
#[test]
@@ -3996,7 +4004,11 @@ pub fn open_file_with_line_plugin_command() {
}
})
.clone();
- assert_snapshot!(format!("{:#?}", new_tab_event));
+ // we do the replace below to avoid the randomness of the temporary folder in the snapshot
+ // while still testing it
+ assert_snapshot!(
+ format!("{:#?}", new_tab_event).replace(&format!("{:?}", temp_folder.path()), "\"CWD\"")
+ );
}
#[test]
@@ -4073,7 +4085,11 @@ pub fn open_file_with_line_floating_plugin_command() {
}
})
.clone();
- assert_snapshot!(format!("{:#?}", new_tab_event));
+ // we do the replace below to avoid the randomness of the temporary folder in the snapshot
+ // while still testing it
+ assert_snapshot!(
+ format!("{:#?}", new_tab_event).replace(&format!("{:?}", temp_folder.path()), "\"CWD\"")
+ );
}
#[test]
diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_floating_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_floating_plugin_command.snap
index 3cef859f7..daff15fa6 100644
--- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_floating_plugin_command.snap
+++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_floating_plugin_command.snap
@@ -1,7 +1,7 @@
---
source: zellij-server/src/plugins/./unit/plugin_tests.rs
-assertion_line: 2820
-expression: "format!(\"{:#?}\", new_tab_event)"
+assertion_line: 3846
+expression: "format!(\"{:#?}\",\n new_tab_event).replace(&format!(\"{:?}\", temp_folder.path()),\n \"\\\"CWD\\\"\")"
---
Some(
SpawnTerminal(
@@ -9,7 +9,9 @@ Some(
OpenFile(
"/path/to/my/file.rs",
None,
- None,
+ Some(
+ "CWD",
+ ),
),
),
Some(
diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_plugin_command.snap
index 7cf9c0c89..f895c55ce 100644
--- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_plugin_command.snap
+++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_plugin_command.snap
@@ -1,7 +1,7 @@
---
source: zellij-server/src/plugins/./unit/plugin_tests.rs
-assertion_line: 2874
-expression: "format!(\"{:#?}\", new_tab_event)"
+assertion_line: 3925
+expression: "format!(\"{:#?}\",\n new_tab_event).replace(&format!(\"{:?}\", temp_folder.path()),\n \"\\\"CWD\\\"\")"
---
Some(
SpawnTerminal(
@@ -9,7 +9,9 @@ Some(
OpenFile(
"/path/to/my/file.rs",
None,
- None,
+ Some(
+ "CWD",
+ ),
),
),
Some(
diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_floating_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_floating_plugin_command.snap
index 2c632abea..da0a726e5 100644
--- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_floating_plugin_command.snap
+++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_floating_plugin_command.snap
@@ -1,7 +1,7 @@
---
source: zellij-server/src/plugins/./unit/plugin_tests.rs
-assertion_line: 2982
-expression: "format!(\"{:#?}\", new_tab_event)"
+assertion_line: 4076
+expression: "format!(\"{:#?}\",\n new_tab_event).replace(&format!(\"{:?}\", temp_folder.path()),\n \"\\\"CWD\\\"\")"
---
Some(
SpawnTerminal(
@@ -11,7 +11,9 @@ Some(
Some(
42,
),
- None,
+ Some(
+ "CWD",
+ ),
),
),
Some(
diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_plugin_command.snap
index 54a04ceb1..ee8feb31a 100644
--- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_plugin_command.snap
+++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_plugin_command.snap
@@ -1,7 +1,7 @@
---
source: zellij-server/src/plugins/./unit/plugin_tests.rs
-assertion_line: 2927
-expression: "format!(\"{:#?}\", new_tab_event)"
+assertion_line: 3999
+expression: "format!(\"{:#?}\",\n new_tab_event).replace(&format!(\"{:?}\", temp_folder.path()),\n \"\\\"CWD\\\"\")"
---
Some(
SpawnTerminal(
@@ -11,7 +11,9 @@ Some(
Some(
42,
),
- None,
+ Some(
+ "CWD",
+ ),
),
),
Some(