mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Fix approximately a bajillion fmt and parsing bugs
(discovered by fuzzing) There's more to come, but this seems like a good batch for now.
This commit is contained in:
parent
8f62eeaf7e
commit
0b8e68f70d
68 changed files with 1011 additions and 229 deletions
|
@ -19,9 +19,9 @@ mod test_parse {
|
|||
use bumpalo::collections::vec::Vec;
|
||||
use bumpalo::{self, Bump};
|
||||
use roc_parse::ast::Expr::{self, *};
|
||||
use roc_parse::ast::StrLiteral::*;
|
||||
use roc_parse::ast::StrSegment::*;
|
||||
use roc_parse::ast::{self, EscapedChar};
|
||||
use roc_parse::ast::{CommentOrNewline, StrLiteral::*};
|
||||
use roc_parse::module::module_defs;
|
||||
use roc_parse::parser::{Parser, SyntaxError};
|
||||
use roc_parse::state::State;
|
||||
|
@ -322,6 +322,22 @@ mod test_parse {
|
|||
assert_eq!(std::mem::size_of::<roc_parse::ast::Expr>(), 40);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_two_line_comment_with_crlf() {
|
||||
let src = "# foo\r\n# bar\r\n42";
|
||||
assert_parses_to(
|
||||
src,
|
||||
Expr::SpaceBefore(
|
||||
&Expr::Num("42"),
|
||||
&[
|
||||
CommentOrNewline::LineComment(" foo"),
|
||||
// We used to have a bug where there was an extra CommentOrNewline::Newline between these.
|
||||
CommentOrNewline::LineComment(" bar"),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// PARSE ERROR
|
||||
|
||||
// TODO this should be parse error, but isn't!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue