mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
Add a Malformed trait, and assert that 'passing' tests don't produce a malformed result
This commit is contained in:
parent
c60dcd763d
commit
a1cd114198
26 changed files with 506 additions and 64 deletions
|
@ -1,7 +1,7 @@
|
|||
use bumpalo::Bump;
|
||||
use roc_fmt::{annotation::Formattable, module::fmt_module};
|
||||
use roc_parse::{
|
||||
ast::{Defs, Expr, Module},
|
||||
ast::{Defs, Expr, Malformed, Module},
|
||||
module::module_defs,
|
||||
parser::{Parser, SyntaxError},
|
||||
state::State,
|
||||
|
@ -104,6 +104,20 @@ impl<'a> Output<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Malformed for Output<'a> {
|
||||
fn is_malformed(&self) -> bool {
|
||||
match self {
|
||||
Output::Header(header) => header.is_malformed(),
|
||||
Output::ModuleDefs(defs) => defs.is_malformed(),
|
||||
Output::Expr(expr) => expr.is_malformed(),
|
||||
Output::Full {
|
||||
header,
|
||||
module_defs,
|
||||
} => header.is_malformed() || module_defs.is_malformed(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> RemoveSpaces<'a> for Output<'a> {
|
||||
fn remove_spaces(&self, arena: &'a Bump) -> Self {
|
||||
match self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue