aboutsummaryrefslogtreecommitdiff
path: root/helix-term/tests
diff options
context:
space:
mode:
authorjazzfool2023-03-30 16:21:40 +0000
committerGitHub2023-03-30 16:21:40 +0000
commitd04288e0f3d292ce47fc0246bcbdc50a9d57ad5e (patch)
treeca103d419254e48e0043fc4acdd610643e126f16 /helix-term/tests
parent5b3dd6a678ba138ea21d7d5dd8d3c8a53c7a6d3b (diff)
Canonicalize paths before stripping current dir as prefix (#6290)
Co-authored-by: jazzfool <shamoslover69@gmail.com>
Diffstat (limited to 'helix-term/tests')
-rw-r--r--helix-term/tests/integration.rs2
-rw-r--r--helix-term/tests/test/commands/write.rs10
-rw-r--r--helix-term/tests/test/splits.rs8
3 files changed, 10 insertions, 10 deletions
diff --git a/helix-term/tests/integration.rs b/helix-term/tests/integration.rs
index cec374af..d77eefed 100644
--- a/helix-term/tests/integration.rs
+++ b/helix-term/tests/integration.rs
@@ -2,8 +2,6 @@
mod test {
mod helpers;
- use std::path::PathBuf;
-
use helix_core::{syntax::AutoPairConfig, Selection};
use helix_term::config::Config;
diff --git a/helix-term/tests/test/commands/write.rs b/helix-term/tests/test/commands/write.rs
index 0ea66a12..26515b7a 100644
--- a/helix-term/tests/test/commands/write.rs
+++ b/helix-term/tests/test/commands/write.rs
@@ -3,7 +3,7 @@ use std::{
ops::RangeInclusive,
};
-use helix_core::diagnostic::Severity;
+use helix_core::{diagnostic::Severity, path::get_normalized_path};
use helix_view::doc;
use super::*;
@@ -23,7 +23,7 @@ async fn test_write_quit_fail() -> anyhow::Result<()> {
assert_eq!(1, docs.len());
let doc = docs.pop().unwrap();
- assert_eq!(Some(file.path()), doc.path().map(PathBuf::as_path));
+ assert_eq!(Some(&get_normalized_path(file.path())), doc.path());
assert_eq!(&Severity::Error, app.editor.get_status().unwrap().1);
}),
false,
@@ -269,7 +269,7 @@ async fn test_write_scratch_to_new_path() -> anyhow::Result<()> {
assert_eq!(1, docs.len());
let doc = docs.pop().unwrap();
- assert_eq!(Some(&file.path().to_path_buf()), doc.path());
+ assert_eq!(Some(&get_normalized_path(file.path())), doc.path());
}),
false,
)
@@ -341,7 +341,7 @@ async fn test_write_new_path() -> anyhow::Result<()> {
Some(&|app| {
let doc = doc!(app.editor);
assert!(!app.editor.is_err());
- assert_eq!(file1.path(), doc.path().unwrap());
+ assert_eq!(&get_normalized_path(file1.path()), doc.path().unwrap());
}),
),
(
@@ -349,7 +349,7 @@ async fn test_write_new_path() -> anyhow::Result<()> {
Some(&|app| {
let doc = doc!(app.editor);
assert!(!app.editor.is_err());
- assert_eq!(file2.path(), doc.path().unwrap());
+ assert_eq!(&get_normalized_path(file2.path()), doc.path().unwrap());
assert!(app.editor.document_by_path(file1.path()).is_none());
}),
),
diff --git a/helix-term/tests/test/splits.rs b/helix-term/tests/test/splits.rs
index 96ced21a..1d70f24a 100644
--- a/helix-term/tests/test/splits.rs
+++ b/helix-term/tests/test/splits.rs
@@ -1,5 +1,7 @@
use super::*;
+use helix_core::path::get_normalized_path;
+
#[tokio::test(flavor = "multi_thread")]
async fn test_split_write_quit_all() -> anyhow::Result<()> {
let mut file1 = tempfile::NamedTempFile::new()?;
@@ -25,21 +27,21 @@ async fn test_split_write_quit_all() -> anyhow::Result<()> {
let doc1 = docs
.iter()
- .find(|doc| doc.path().unwrap() == file1.path())
+ .find(|doc| doc.path().unwrap() == &get_normalized_path(file1.path()))
.unwrap();
assert_eq!("hello1", doc1.text().to_string());
let doc2 = docs
.iter()
- .find(|doc| doc.path().unwrap() == file2.path())
+ .find(|doc| doc.path().unwrap() == &get_normalized_path(file2.path()))
.unwrap();
assert_eq!("hello2", doc2.text().to_string());
let doc3 = docs
.iter()
- .find(|doc| doc.path().unwrap() == file3.path())
+ .find(|doc| doc.path().unwrap() == &get_normalized_path(file3.path()))
.unwrap();
assert_eq!("hello3", doc3.text().to_string());