mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
Merge pull request #4508 from roc-lang/windows-final-cli-tests
Windows final cli tests
This commit is contained in:
commit
0920fb4227
11 changed files with 243 additions and 128 deletions
|
@ -13,6 +13,11 @@ pub mod spaces;
|
|||
use bumpalo::{collections::String, Bump};
|
||||
use roc_parse::ast::Module;
|
||||
|
||||
#[cfg(windows)]
|
||||
const NEWLINE: &str = "\r\n";
|
||||
#[cfg(not(windows))]
|
||||
const NEWLINE: &str = "\n";
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Ast<'a> {
|
||||
pub module: Module<'a>,
|
||||
|
@ -99,7 +104,9 @@ impl<'a> Buf<'a> {
|
|||
|
||||
pub fn newline(&mut self) {
|
||||
self.spaces_to_flush = 0;
|
||||
self.text.push('\n');
|
||||
|
||||
self.text.push_str(NEWLINE);
|
||||
|
||||
self.beginning_of_line = true;
|
||||
}
|
||||
|
||||
|
@ -183,14 +190,14 @@ fn fmt_text_eof(text: &mut bumpalo::collections::String<'_>) {
|
|||
// There's some whitespace at the end of this file, but the first
|
||||
// whitespace char after the last non-whitespace char isn't a newline.
|
||||
// So replace that whitespace char (and everything after it) with a newline.
|
||||
text.replace_range(last_whitespace_index.., "\n");
|
||||
text.replace_range(last_whitespace_index.., NEWLINE);
|
||||
}
|
||||
None => {
|
||||
debug_assert!(last_whitespace_index == text.len());
|
||||
debug_assert!(!text.ends_with(char::is_whitespace));
|
||||
|
||||
// This doesn't end in whitespace at all, so add a newline.
|
||||
text.push('\n');
|
||||
text.push_str(NEWLINE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue