-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy patherrors.rs
38 lines (35 loc) · 826 Bytes
/
errors.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[repr(u32)]
pub enum PyParseError {
UnexpectedIndent,
ExpectedIndent,
DisabledFeature,
}
impl From<PyParseError> for u32 {
fn from(e: PyParseError) -> u32 {
e as u32
}
}
#[cfg(test)]
mod tests {
use nom;
use nom::types::CompleteStr;
use nom::{Context, ErrorKind};
use nom_locate::LocatedSpan;
use helpers::*;
use statements::statement;
#[test]
fn if_no_condition() {
assert_eq!(
statement(make_strspan("if:\n foo"), 0),
Err(nom::Err::Failure(Context::Code(
LocatedSpan {
offset: 2,
line: 1,
fragment: CompleteStr(":\n foo")
},
ErrorKind::Alt
)))
);
}
}