Skip to content

Commit

Permalink
fix tests, clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
CptPotato committed Jan 23, 2023
1 parent 4e39f4e commit d264500
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion helix-core/src/line_ending.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl LineEnding {
///
/// [`LineEnding::Crlf`] on Windows, otherwise [`LineEnding::LF`].
#[inline]
pub fn native() -> Self {
pub const fn native() -> Self {
#[cfg(target_os = "windows")]
return LineEnding::Crlf;
#[cfg(not(target_os = "windows"))]
Expand Down
2 changes: 1 addition & 1 deletion helix-term/tests/test/auto_pairs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use helix_core::{auto_pairs::DEFAULT_PAIRS, hashmap};

use super::*;

const LINE_END: &str = helix_core::DEFAULT_LINE_ENDING.as_str();
const LINE_END: &str = helix_core::LineEnding::native().as_str();

fn differing_pairs() -> impl Iterator<Item = &'static (char, char)> {
DEFAULT_PAIRS.iter().filter(|(open, close)| open != close)
Expand Down
2 changes: 1 addition & 1 deletion helix-term/tests/test/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ pub fn temp_file_with_contents<S: AsRef<str>>(
/// character, and if one doesn't exist already, appends the system's
/// appropriate line ending to the end of a string.
pub fn platform_line(input: &str) -> String {
let line_end = helix_core::DEFAULT_LINE_ENDING.as_str();
let line_end = helix_core::LineEnding::native().as_str();

// we can assume that the source files in this code base will always
// be LF, so indoc strings will always insert LF
Expand Down
10 changes: 6 additions & 4 deletions helix-view/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1391,10 +1391,12 @@ mod test {

#[test]
fn test_line_ending() {
assert_eq!(
Document::default().text().to_string(),
DEFAULT_LINE_ENDING.as_str()
);
for line_ending in [LineEnding::LF, LineEnding::Crlf] {
assert_eq!(
Document::new(line_ending).text().to_string(),
line_ending.as_str()
);
}
}

macro_rules! decode {
Expand Down

0 comments on commit d264500

Please sign in to comment.